0.37.2 is able to load rubocop-rspec. 0.38 fails with an error:
LoadError: cannot load such file -- the-project-path/rubocop-rspec
Stacktrace:
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:40:in `require'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:40:in `block in load_file'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:39:in `each'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:39:in `load_file'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:99:in `configuration_from_file'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_store.rb:41:in `for'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/target_finder.rb:113:in `excluded_dirs'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/target_finder.rb:91:in `find_files'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/target_finder.rb:61:in `target_files_in_dir'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/target_finder.rb:32:in `find'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/runner.rb:47:in `find_target_files'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/runner.rb:31:in `run'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/cli.rb:30:in `run'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/rake_task.rb:49:in `run_cli'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/rake_task.rb:37:in `run_main_task'
D:/Ruby/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/rake_task.rb:29:in `block (2 levels) in initialize'
...
I made sure rubocop-rspec is in the Gemfile and we run bundle exec rubocop.
A quick git bisect shows that 5fdd79587090fd33a70e0b2be1138e391cd499e6 is the first bad commit.
Failing .rubocop.yml:
require: rubocop-rspec
Is there any workaround?
Changing the require to this seems to work:
AllCops:
Include:
- rubocop-rspec
Changing the code in config_loader.rb to an earlier version was my work around:
# ~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb
# Temporary Code copied from earlier version of gem:
Array(hash.delete('require')).each { |r| require(r) }
# Code Commented Out:
# config_dir = File.dirname(path)
# Array(hash.delete('require')).each do |r|
# require(File.join(config_dir, r))
# end
@mikegee it didn't work here.
Sorry, I think my app depends on Bundler to do the requires.
This problem comes again with rubucop 0.50 and rubocop-spec 1.19.0. I've fixed this with @mikegee tip.
This problem comes again with rubucop 0.50 and rubocop-spec 1.19.0.
rubocop-rspec 1.19.0 is a compatibility release intended to work with rubocop 0.51.
@Drenmi I've tested both versions (rubocop 0.50 with rubocop-rspec 1.19.0) and
(rubocop 0.51 with rubocop-rspec 1.19.0). I've tested rubocop-rspec 1.18.0
with both rubocop versions.
Most helpful comment
Changing the
requireto this seems to work: