Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable rubocop rails cops automatically?

Is there a way to always enable rubocop rails cops via the config? I know I can run them via -R, but I'd like to make sure, that they are run when I just call rubocop alone.

like image 901
Bruno E. Avatar asked Jan 27 '17 10:01

Bruno E.


1 Answers

Things have changed a bit since the last answer:

Rubocop team wanted to separate rails from the core of rubocop (which I think is great).
See this issue and this PR for more information.

So the new way of using Rails cops in Rubocop is by installing ruboco-rails gem.
Then in .rubocop.yml simply add:

require: rubocop-rails

Details here.

Enjoy!

like image 59
Francois Avatar answered Oct 01 '22 05:10

Francois