What is Rubocop Airbnb
It is a library that checks whether the written code complies with the coding standard. Rubocop is famous as a syntax analysis tool, but there are various settings, so this time we will introduce rubocop-airbnb customized for the development site.
group :development, :test do gem'rubocop-airbnb' end
$ bundle install
Create new .rubocop.yml and .rubocop_airbnb.yml in the same directory as the Gemfile.
inherit_from: -.rubocop_airbnb.yml AllCops: Exclude: -'bin/*' -'config/**/*' -'db/**/*' -'spec/spec_helper.rb'
If you get an error when calling, please be careful as you may forget to add “.” or “_” in this file or make a mistake in input.
$ rubocop --require rubocop-airbnb
Automatic correction method
$ rubocop --require rubocop-airbnb -a
The fix will get harder later, so be sure to try it before you start writing code.