Integrated Rubocop warns of 'unknown cop' for Rspec, but the cop seems correct to me.

Rubocop shows this warning:

But this cop is defined in rubocop-rspec:

https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecmultiplememoizedhelpers

Which is mentioned at the top of .rubocop.yml:

# head .rubocop.yml
require:
- rubocop-rails
- rubocop-rspec

AllCops:
DisplayCopNames: true
TargetRailsVersion: 4.2
TargetRubyVersion: 2.7.4
NewCops: enable
Exclude:

And the gem is available to the project SDK:

So why doesn't RubyMine know about?

0
4 comments

Hello Austin,

just to be sure, how does it go if you run RuboCop manually in the terminal?

0

Hi Olga, here is the output of running rubocop from the terminal with and without 'bundle':

# bundle exec rubocop spec/messages/price_prediction_message_spec.rb
Inspecting 1 file
.

1 file inspected, no offenses detected

 

# rubocop spec/messages/price_prediction_message_spec.rb
Unable to activate rubocop-rspec-1.44.1, because rubocop-1.22.3 conflicts with rubocop (~> 0.87)
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/specification.rb:2247:in `raise_if_conflicts'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/specification.rb:1369:in `activate'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems.rb:217:in `rescue in try_activate'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems.rb:210:in `try_activate'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:151:in `rescue in require'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:147:in `require'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_loader_resolver.rb:17:in `block (2 levels) in resolve_requires'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_loader_resolver.rb:13:in `each'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_loader_resolver.rb:12:in `tap'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_loader.rb:44:in `load_file'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_loader.rb:103:in `configuration_from_file'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_store.rb:68:in `for_dir'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/config_store.rb:47:in `for_pwd'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/cli.rb:98:in `parallel_by_default!'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/lib/rubocop/cli.rb:45:in `run'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/exe/rubocop:12:in `block in <top (required)>'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/rubocop-1.22.3/exe/rubocop:12:in `<top (required)>'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/bin/rubocop:23:in `load'
/Users/Austin.Chamberlin/.rbenv/versions/2.7.4/bin/rubocop:23:in `<main>'
0

Hello Austin,

sorry for not getting back to you sooner. It'd be interesting to take a look at your idea.log (Help - Show log in), lines where RuboCop is called.

Could you please add the following lines to Help | Diagnostic Tools | Debug Log Settings, then restart RubyMine, reproduce the problem (call RuboCop from the IDE) and attach idea.log (Help | Show log in):

#org.jetbrains.plugins.ruby.ruby.run.RubyCommandLine
#com.intellij.execution.configurations.GeneralCommandLine
0

Please sign in to leave a comment.