Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSpec/FilePath exception with Rubocop 0.36.0 #62

Closed
DMA57361 opened this issue Jan 15, 2016 · 8 comments
Closed

RSpec/FilePath exception with Rubocop 0.36.0 #62

DMA57361 opened this issue Jan 15, 2016 · 8 comments

Comments

@DMA57361
Copy link

I've just been working through upgrading Rubocop to 0.36.0 and the RSpec/FilePath cop seems to be raising an exception for every file it checks. My rubocop-rspec is version 1.3.1, I believe this is up to date. Info string output by Rubocop at end of debug run:

0.36.0 (using Parser 2.3.0.1, running on ruby 2.2.0 x86_64-darwin14)

The new TargetRubyVersion config has been set to 2.2 (and the app currently runs 2.2.0, as you can see above) and we have no custom configuration for this cop.


This is the full backtrace as given when I run Rubocop with --debug (mildly anonymised)

An error occurred while RSpec/FilePath cop was inspecting /Users/username/src/project_name/spec/models/account/account_spec.rb.
undefined method `const_name' for #<RuboCop::Cop::RSpec::FilePath:0x007faa0206b298>
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-rspec-1.3.1/lib/rubocop/cop/rspec/file_path.rb:25:in `on_top_level_describe'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-rspec-1.3.1/lib/rubocop/rspec/top_level_describe.rb:13:in `on_send'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:38:in `block (2 levels) in on_send'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:88:in `with_cop_error_handling'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:37:in `block in on_send'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:35:in `each'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:35:in `on_send'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:259:in `process'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `map'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `process_all'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/parser-2.3.0.1/lib/parser/ast/processor.rb:9:in `process_regular_node'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:42:in `on_block'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:259:in `process'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:276:in `block in process_all'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `map'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:275:in `process_all'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/parser-2.3.0.1/lib/parser/ast/processor.rb:9:in `process_regular_node'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:42:in `on_begin'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/ast-2.2.0/lib/ast/processor/mixin.rb:259:in `process'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/commissioner.rb:54:in `investigate'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cop/team.rb:37:in `inspect_file'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:194:in `inspect_file'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:164:in `block in do_inspection_loop'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:158:in `loop'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:158:in `do_inspection_loop'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:87:in `process_file'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:59:in `block in inspect_files'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:57:in `each'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:57:in `inspect_files'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/runner.rb:35:in `run'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/lib/rubocop/cli.rb:30:in `run'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/bin/rubocop:14:in `block in <top (required)>'
/Users/username/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/gems/rubocop-0.36.0/bin/rubocop:13:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/bin/rubocop:23:in `load'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/bin/rubocop:23:in `<main>'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/bin/ruby_executable_hooks:15:in `eval'
/Users/username/.rvm/gems/ruby-2.2.0@project_name/bin/ruby_executable_hooks:15:in `<main>'
@davidakachaos
Copy link

I came across the same issue. For now I've disabled the specific check when using the latest rubocop.

@DexterTheDragon
Copy link

Looks like #60 has a fix for this

@patricklewis
Copy link

Thanks @DexterTheDragon, #60 fixed this const_name error for me.

@lucascaton
Copy link

Any news on this one?

@dpehrson
Copy link

dpehrson commented Feb 6, 2016

Would love to see a release with this fixed, I've sadly had to uninstall this gem because it's holding back lots of other gems that require >= 0.36

@mockdeep
Copy link
Contributor

I just disabled the rule for now with:

RSpec/FilePath:
  Enabled: false

@mkempe
Copy link

mkempe commented Feb 14, 2016

Just tested the master branch with RuboCop ~> 0.37.2, works great. Thanks a lot.

@nijikon
Copy link
Collaborator

nijikon commented Feb 16, 2016

This issue was fixed in the latest release 1.4.0.

@nijikon nijikon closed this as completed Feb 16, 2016
jpignata added a commit to codeclimate/codeclimate-rubocop that referenced this issue Feb 16, 2016
There are some incompatibilites between the latest version of RuboCop
and rubocop-rspec which were fixed in this release.

See: rubocop/rubocop-rspec#62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants