Things to check at work:
- Is the rubocop.yml actually in the installed gem? It may be, that it hasn't been included in the install version.
- Is there a
~/.rubocop.yml
with the same content? - Is Rubocop up-to-date?
~/.rubocop.yml
:
Metrics/LineLength:
Max: 100
$ bundle exec rubocop -d config/application.rb
For /home/phansch/code/rails_playground: configuration from /home/phansch/code/rails_playground/.rubocop.yml
Inheriting configuration from /home/phansch/.rvm/gems/ruby-2.4.1/bundler/gems/rubocop-bug-gem-edf3b83692c7/rubocop.yml
/home/phansch/.rvm/gems/ruby-2.4.1/bundler/gems/rubocop-bug-gem-edf3b83692c7/rubocop.yml: Style/LineLength has the wrong namespace - should be Metrics
Default configuration from /home/phansch/.rvm/gems/ruby-2.4.1/gems/rubocop-0.48.1/config/default.yml
Inheriting configuration from /home/phansch/.rvm/gems/ruby-2.4.1/gems/rubocop-0.48.1/config/enabled.yml
Inheriting configuration from /home/phansch/.rvm/gems/ruby-2.4.1/gems/rubocop-0.48.1/config/disabled.yml
AllCops/Exclude configuration from /home/phansch/.rubocop.yml
Inspecting 1 file
Scanning /home/phansch/code/rails_playground/config/application.rb
.
1 file inspected, no offenses detected
Finished in 0.1449760969990166 seconds
$ bundle exec rubocop -d config/application.rb
For /home/phansch/code/rails_playground: configuration from /home/phansch/code/rails_playground/.rubocop.yml
Inheriting configuration from /home/phansch/.rvm/gems/ruby-2.4.1/bundler/gems/rubocop-bug-gem-faa56588b7ef/rubocop.yml
/home/phansch/.rvm/gems/ruby-2.4.1/bundler/gems/rubocop-bug-gem-faa56588b7ef/rubocop.yml: Style/EmptyLines has the wrong namespace - should be Layout
Default configuration from /home/phansch/.rvm/gems/ruby-2.4.1/gems/rubocop-0.49.0/config/default.yml
Inheriting configuration from /home/phansch/.rvm/gems/ruby-2.4.1/gems/rubocop-0.49.0/config/enabled.yml
Inheriting configuration from /home/phansch/.rvm/gems/ruby-2.4.1/gems/rubocop-0.49.0/config/disabled.yml
AllCops/Exclude configuration from /home/phansch/.rubocop.yml
Inspecting 1 file
Scanning /home/phansch/code/rails_playground/config/application.rb
.
1 file inspected, no offenses detected
Finished in 0.09542520699324086 seconds
One issue seems to be that the file is starting with
.rubocop
in the shared gem, if it is called something else, it seems to work. The problem is inFile.basename(loaded_path).start_with?('.rubocop')