Airbnb specific analysis for RuboCop.
Just put this in your
Gemfile it depends on the appropriate version of rubocop and rubocop-rspec.
Note: If you want to run with Ruby 2.2 you will need to set your version to 2
gem 'rubocop-airbnb', '~> 2'
You need to tell RuboCop to load the Airbnb extension. There are three ways to do this:
RuboCop configuration file
First Create a new file
.rubocop_airbnb.yml in the same directory as your
this file should contain
require: - rubocop-airbnb
Next add the following to
or add before
.rubocop_todo.yml in your existing
inherit_from: - .rubocop_airbnb.yml - .rubocop_todo.yml
You need to inherit
.rubocop_airbnb.yml from another file because of Rubocop order of operations.
require commands. If the configuration is not in a separate file
you could potentially experience a bunch of warnings from
.rubocop_todo.yml for non-existant
Now you can run
rubocop and it will automatically load the RuboCop Airbnb
cops together with the standard cops.
rubocop --require rubocop-airbnb
All cops are located under
lib/rubocop/cop/airbnb, and contain
.rubocop.yml, you may treat the Airbnb cops just like any other
cop. For example:
Airbnb/PhraseBundleKeys: Exclude: - spec/my_poorly_named_spec_file.rb