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

"wrong number of arguments (given 3, expected 1)" cop/cop.rb:121:in `add_offense' #5918

Closed
paulmakepeace opened this issue May 26, 2018 · 2 comments
Labels

Comments

@paulmakepeace
Copy link

paulmakepeace commented May 26, 2018

rubocop -d --auto-gen-config --exclude-limit 10000 is producing,

An error occurred while RSpec/MultipleExpectations cop was inspecting spec/foo_spec.rb:30:10.
wrong number of arguments (given 3, expected 1)
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/cop.rb:121:in `add_offense'
.../gems/ruby-2.5.1/gems/rubocop-rspec-1.18.0/lib/rubocop/cop/rspec/multiple_expectations.rb:100:in `flag_example'
.../gems/ruby-2.5.1/gems/rubocop-rspec-1.18.0/lib/rubocop/cop/rspec/multiple_expectations.rb:74:in `on_block'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:57:in `block (2 levels) in trigger_responding_cops'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:105:in `with_cop_error_handling'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:56:in `block in trigger_responding_cops'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:55:in `each'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:55:in `trigger_responding_cops'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `block in on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `each'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:154:in `on_block'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:154:in `on_block'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `block in on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `each'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:154:in `on_block'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:154:in `on_block'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `block in on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `each'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:154:in `on_block'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `block in on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `each'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:49:in `on_begin'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/ast/traversal.rb:12:in `walk'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/commissioner.rb:45:in `investigate'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/team.rb:114:in `investigate'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/team.rb:102:in `offenses'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cop/team.rb:44:in `inspect_file'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:265:in `inspect_file'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:212:in `block in do_inspection_loop'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:244:in `block in iterate_until_no_changes'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:237:in `loop'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:237:in `iterate_until_no_changes'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:208:in `do_inspection_loop'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:111:in `block in file_offenses'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:129:in `file_offense_cache'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:109:in `file_offenses'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:100:in `process_file'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:75:in `each'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:75:in `reduce'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:75:in `each_inspected_file'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:67:in `inspect_files'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/runner.rb:39:in `run'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cli.rb:160:in `execute_runner'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cli.rb:113:in `run_all_cops_auto_gen_config'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cli.rb:86:in `execute_runners'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/lib/rubocop/cli.rb:41:in `run'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/bin/rubocop:13:in `block in <top (required)>'
.../rubies/ruby-2.5.1/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
.../gems/ruby-2.5.1/gems/rubocop-0.56.0/bin/rubocop:12:in `<top (required)>'
.../gems/ruby-2.5.1/bin/rubocop:23:in `load'
.../gems/ruby-2.5.1/bin/rubocop:23:in `<main>'
.../gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `eval'
.../gems/ruby-2.5.1/bin/ruby_executable_hooks:15:in `<main>'

It's producing hundreds of these stack traces, not all the same but they all share the same failure point (wrong number of arguments at cop.rb:121). The spec file contents can be bare-bones and the error is still thrown. Happy to provide more info if needed!

RuboCop version

$ rubocop -V
0.56.0 (using Parser 2.5.1.0, running on ruby 2.5.1 x86_64-darwin17)
@bbatsov
Copy link
Collaborator

bbatsov commented May 27, 2018

Seems you're using some older version of rubocop-rspec, which is not compatible with RuboCop 0.56.

@Drenmi Drenmi added the invalid label Jun 7, 2018
@Drenmi
Copy link
Collaborator

Drenmi commented Jun 7, 2018

@paulmakepeace The compatibility release of rubocop-rspec was 1.19.0. Upgrading should resolve this issue.

@Drenmi Drenmi closed this as completed Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants