When attempting to run only certain department cops form rubocop-rails using the rubocop --only flag, I get following error:
Error: `Rails/*` has been extracted to the `rubocop-rails` gem.
(obsolete configuration found in .rubocop.yml, please update it)
It should allow me to run Rails cops only with one of them being disabled but the rest of the department working.
Fails
# Gemfile
source 'https://rubygems.org'
gem 'rubocop-rails'
# .rubocop.yml
AllCops:
Exclude:
- bin/**/*
- db/schema.rb
- .gemspec/**/*
- .bundle/**/*
- vendor/**/*
- '**/dummy**/*'
- !ruby/regexp /old_and_unused\.rb$/
Rails/NotNullColumn:
Enabled: false
# Shell command I use to run it
bundle exec rubocop --only Rails -- require rubocop-rails
Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:
rubocop -V
1.6.1 (using Parser 2.7.2.0, rubocop-ast 1.3.0, running on ruby 2.7.1 x86_64-linux)
[test]$ rubocop -v
Thank you for your feedback. A workaround is to change require rubocop-rails from command line argument to .rubocop.yml config.
+require: rubocop-rails
AllCops:
Exclude:
- bin/**/*
- db/schema.rb
- .gemspec/**/*
- .bundle/**/*
- vendor/**/*
- '**/dummy**/*'
- !ruby/regexp /old_and_unused\.rb$/
Rails/NotNullColumn:
Enabled: false
I'll transfer the issue to the core because it is related to https://github.com/rubocop-hq/rubocop/pull/9169.
I'm on this.