Warning: unrecognized cop Rails/
Just in case you happened to copy the .rubocop.yml
file from a different project like I did, in my case I just forgot to add the rubocop-rails gem, which includes the Rails/ cops.
Install it like any other gem and and require it in your .rubocop.yml
file:
# Gemfile
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
$ bundle install
# .rubocop.yml
require: rubocop-rails
$ rubocop
It seems like rubocop warnings is preventing rubocop to finish. In your version of rubocop there should be a setting called suppressRubocopWarnings
try checking that if you know that the warnings doesn't need to be handled.
You can do that by typing cmd+shift+p
and type Open User Settings.
There you can search for rubocop
and check the suppressRubocopWarnings
checkbox, restart VSCode and it should work.
If you are using an older version of VSCode without the fancy UI, you should be able to add "ruby.rubocop.suppressRubocopWarnings": true,
in your user settings json.
It seems to be common to get these kind of warnings if you share a rubocop.yml file across multiple projects.
Source: https://github.com/misogi/vscode-ruby-rubocop/pull/97