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

An error occurred while RSpec/DescribedClass cop #790

Closed
skorks opened this issue Jul 24, 2019 · 3 comments · Fixed by #791
Closed

An error occurred while RSpec/DescribedClass cop #790

skorks opened this issue Jul 24, 2019 · 3 comments · Fixed by #791
Labels

Comments

@skorks
Copy link

skorks commented Jul 24, 2019

Steps to reproduce:

± % bundle exec rubocop -d                                                                                                                                                                                                                                                                                                                                           !11734
For /Users/askorkin/projects/work/test_rubocop/broken-rubocop-rspec-master: configuration from /Users/askorkin/projects/work/test_rubocop/broken-rubocop-rspec-master/.rubocop.yml
configuration from /Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/config/default.yml
configuration from /Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/config/default.yml
Default configuration from /Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/config/default.yml
Inspecting 2 files
Scanning /Users/askorkin/projects/work/test_rubocop/broken-rubocop-rspec-master/Gemfile
.Scanning /Users/askorkin/projects/work/test_rubocop/broken-rubocop-rspec-master/spec/broken_spec.rb
An error occurred while RSpec/DescribedClass cop was inspecting /Users/askorkin/projects/work/test_rubocop/broken-rubocop-rspec-master/spec/broken_spec.rb:16:0.
undefined method `cbase_type?' for :klass:Symbol
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:169:in `const_name'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:172:in `const_name'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:132:in `full_const_name'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:128:in `offensive_described_class?'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:114:in `offensive?'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:80:in `find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:85:in `block in find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:193:in `block in each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:84:in `find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:85:in `block in find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:193:in `block in each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:84:in `find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:85:in `block in find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:193:in `block in each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:84:in `find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:85:in `block in find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:193:in `block in each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/node.rb:190:in `each_child_node'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:84:in `find_usage'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-rspec-1.34.0/lib/rubocop/cop/rspec/described_class.rb:61:in `on_block'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:57:in `block (2 levels) in trigger_responding_cops'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:128:in `with_cop_error_handling'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:56:in `block in trigger_responding_cops'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:55:in `each'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:55:in `trigger_responding_cops'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:32:in `block (2 levels) in <class:Commissioner>'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/traversal.rb:50:in `block in on_begin'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/traversal.rb:50:in `each'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/traversal.rb:50:in `on_begin'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/ast/traversal.rb:13:in `walk'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/commissioner.rb:44:in `investigate'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/team.rb:119:in `investigate'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/team.rb:107:in `offenses'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cop/team.rb:44:in `inspect_file'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:277:in `inspect_file'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:225:in `block in do_inspection_loop'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:257:in `block in iterate_until_no_changes'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:250:in `loop'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:250:in `iterate_until_no_changes'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:221:in `do_inspection_loop'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:124:in `block in file_offenses'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:142:in `file_offense_cache'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:122:in `file_offenses'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:110:in `process_file'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:87:in `block in each_inspected_file'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:86:in `each'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:86:in `reduce'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:86:in `each_inspected_file'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:73:in `inspect_files'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/runner.rb:39:in `run'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cli.rb:210:in `execute_runner'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cli.rb:80:in `execute_runners'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/lib/rubocop/cli.rb:51:in `run'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/exe/rubocop:13:in `block in <top (required)>'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rubocop-0.73.0/exe/rubocop:12:in `<top (required)>'
/Users/askorkin/.rbenv/versions/2.5.0/bin/rubocop:23:in `load'
/Users/askorkin/.rbenv/versions/2.5.0/bin/rubocop:23:in `<top (required)>'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `load'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:28:in `run'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli.rb:463:in `exec'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli.rb:27:in `dispatch'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/cli.rb:18:in `start'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/exe/bundle:30:in `block in <top (required)>'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/askorkin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/exe/bundle:22:in `<top (required)>'
/Users/askorkin/.rbenv/versions/2.5.0/bin/bundle:23:in `load'
/Users/askorkin/.rbenv/versions/2.5.0/bin/bundle:23:in `<main>'
.

2 files inspected, no offenses detected

1 error occurred:
An error occurred while RSpec/DescribedClass cop was inspecting /Users/askorkin/projects/work/test_rubocop/broken-rubocop-rspec-master/spec/broken_spec.rb:16:0.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop-hq/rubocop/issues

Mention the following information in the issue report:
0.73.0 (using Parser 2.6.3.0, running on ruby 2.5.0 x86_64-darwin16)
Finished in 0.6356740000192076 seconds
@bquorning
Copy link
Collaborator

@pirj?

pirj added a commit to pirj/rubocop-rspec that referenced this issue Jul 24, 2019
If a local variable was part of the described class's namespace, the cop
was failing.

fixes rubocop#790
@Darhazer Darhazer added the bug label Jul 24, 2019
pirj added a commit to pirj/rubocop-rspec that referenced this issue Jul 24, 2019
If a local variable was part of the described class's namespace, the cop
was failing.

fixes rubocop#790
@pirj
Copy link
Member

pirj commented Jul 24, 2019

Thanks for the detailed report @skorks, fixed in #791.

@skorks
Copy link
Author

skorks commented Jul 24, 2019

@pirj no probs, thanks for being so quick with a fix

pirj added a commit to pirj/rubocop-rspec that referenced this issue Jul 24, 2019
If a local variable was part of the described class's namespace, the cop
was failing.

fixes rubocop#790
kellysutton pushed a commit to kellysutton/rubocop-rspec that referenced this issue Oct 28, 2019
If a local variable was part of the described class's namespace, the cop
was failing.

fixes rubocop#790
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants