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

'Next' cop errors on a method invoking super with 2+ args and a non-empty block. #1115

Closed
smangelsdorf opened this issue May 27, 2014 · 2 comments

Comments

@smangelsdorf
Copy link
Contributor

I've hit a Rubocop failure with a certain snippet of Ruby, and I've managed to simplify it to:

def x(a)
  super(a, a) { a }
end

Strangely:

  • If I remove one of the parameters to super(), it works
  • If I use any method name instead of super, it works
  • If I remove the reference to a inside the block, it works

The original was in a module, hence the use of super, but the error is identical when not in a module. The error I'm seeing is:

1 error occurred:
An error occurred while Next cop was inspecting /Users/shaun/Projects/status/test.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
Mention the following information in the issue report:
0.22.0 (using Parser 2.1.9, running on ruby 2.1.2 x86_64-darwin13.0)

I invoked it simply as rubocop test.rb, and my .rubocop.yml contains:

AllCops:
  Exclude:
    - db/schema.rb

Documentation:
  Enabled: false

I enabled debug output and I see:

no implicit conversion of Parser::AST::Node into String
/Users/shaun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rubocop-0.22.0/lib/rubocop/cop/style/next.rb:59:in `match'
/Users/shaun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rubocop-0.22.0/lib/rubocop/cop/style/next.rb:59:in `method?'
/Users/shaun/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rubocop-0.22.0/lib/rubocop/cop/style/next.rb:35:in `on_block'

Let me know if there's any further help I can offer.

@geniou
Copy link
Contributor

geniou commented May 27, 2014

I take a look.

@geniou
Copy link
Contributor

geniou commented May 27, 2014

@smangelsdorf thanks to the great describing of the bug it was easy to provide a fix.

bbatsov added a commit that referenced this issue May 27, 2014
[Fix #1115] Fix Next when methods invoking super
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

2 participants