12
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rubocop−airbnbを使うにあたって 

Posted at

#rubocopとは

Ruby style guideを基づいて作られたstatic code analyzerです。
gitはこちら

#rubocop−airbnbとは
airbnb社が作っているrubocopです。
gitはこちら

#導入
Gemfileに以下のgemを追加しましょう。

group :development, :test do
  gem 'rubocop-airbnb'

追加しましたら、bundle installを実行しましょう。

#設定
アプリのフォルダに.rubocop.ymlと.rubocop_airbnb.ymlファイルを作成し、以下の内容を記入しましょう

.rubocop.yml
inherit_from:
  - .rubocop_airbnb.yml

#以下にはrubocopで検証したくないフォルダを指定する
AllCops:
  Exclude:
    - 'db/**/*'
    - 'bin/*'
    - 'config/environments/*'
    - 'config/application.rb'
    - 'config/initializers/*'
    - 'config/spring.rb'
    - 'lib/tasks/*'
    - 'vendor/**/*'
    - 'path/ruby'

.rubocop_airbnb.yml
require:
  - rubocop-airbnb

ここまでの設定が終わりましたら、ターミナルで以下を実行

bundle exec rubocop --require rubocop-airbnb

正常に起動すれば大丈夫です。

12
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?