0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RuboCop-airbnbの導入方法

Posted at

環境構築の手順

①Gemの追加

Gemfile
group :development, :test do
  ...
  # 以下追加
  gem "rubocop-airbnb"
end

②rubocop-airbnb の設定

ルートディレクトリに以下の2ファイルを作成する

.rubocop.yml
inherit_from:
  - .rubocop_airbnb.yml

# Rails用に最適化
Rails:
  Enabled: true

# 文字数の上限を80文字から変更
LineLength:
  Max: 130
  
# rubocopで検証したくないフォルダを指定
AllCops:
  Exclude:
    - 'db/**/*'
    - 'config/**/*'
    - 'bin/*'
    - '**/Gemfile'
    - 'vendor/**/*'
    - '.git/**/*'
.rubocop_airbnb.yml
require:
  - rubocop-airbnb

③テストを実行してみる

bundle exec rubocop --require rubocop-airbnb

自動修正するときは以下のコマンドを使用する

bundle exec rubocop --require rubocop-airbnb -a
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?