rubocop / rubocop-rspec

Code style checking for RSpec files.
https://docs.rubocop.org/rubocop-rspec
MIT License
806 stars 277 forks source link

LoadError with Rubocop 0.38.0 #75

Closed shortdudey123 closed 8 years ago

shortdudey123 commented 8 years ago

I am trying to update from Rubocop 0.37.2 to 0.38.0 and i am getting a LoadError. Not sure if this is an issue on this side or the Rubocop side

$ bundle exec rubocop
Running RuboCop...
rake aborted!
LoadError: cannot load such file -- /Users/username/github/rubocop-rspec
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:40:in `require'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:40:in `block in load_file'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:39:in `each'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:39:in `load_file'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_loader.rb:99:in `configuration_from_file'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/config_store.rb:41:in `for'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/cli.rb:88:in `apply_default_formatter'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/cli.rb:26:in `run'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/rake_task.rb:49:in `run_cli'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/rake_task.rb:37:in `run_main_task'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/rake_task.rb:29:in `block (2 levels) in initialize'
/Users/username/github/.bundle/ruby/2.2.0/gems/rubocop-0.38.0/lib/rubocop/rake_task.rb:27:in `block in initialize'
Tasks: TOP => default => rubocop
(See full trace by running task with --trace)
$
$ cat .rubocop.yml 
require: rubocop-rspec
$ 

Maybe its the way the rubocop require changed?? https://github.com/bbatsov/rubocop/compare/v0.37.2...v0.38.0#diff-e2fc41e8fa0504d203570a8d822495afR40

awead commented 8 years ago

removing the "require: rubocop-rspec" from the yaml file makes it go away and appears to not break anything. Not sure why though.

mjgiarlo commented 8 years ago

@awead It does break running "rubocop" without arguments, it looks like:

$ rubocop
Warning: unrecognized cop RSpec/DescribeClass found in /home/mjg/workspace/sufia/.rubocop_todo.yml
Warning: unrecognized cop RSpec/AnyInstance found in /home/mjg/workspace/sufia/.rubocop.yml
Warning: unrecognized cop RSpec/ExampleWording found in /home/mjg/workspace/sufia/.rubocop.yml
Warning: unrecognized cop RSpec/FilePath found in /home/mjg/workspace/sufia/.rubocop.yml
Warning: unrecognized cop RSpec/InstanceVariable found in /home/mjg/workspace/sufia/.rubocop.yml
Warning: unrecognized cop RSpec/NotToNot found in /home/mjg/workspace/sufia/.rubocop.yml
Warning: unrecognized cop RSpec/DescribeClass found in /home/mjg/workspace/sufia/.rubocop.yml
Inspecting 418 files

I can get around this by using rake rubocop since I have that task configured to require 'rubocop-rspec', or by invoking rubocop with the --require rubocop-rspec argument.

mjgiarlo commented 8 years ago

Looks like they're working on a fix to Rubocop for this, at which point this issue can be closed in rubocop-rspec: https://github.com/bbatsov/rubocop/pull/2936

shortdudey123 commented 8 years ago

Cool, i will close this and assume Rubocop 0.38.1 will work correctly