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

rubocop v0.29.1 crashed when auto-correct hash with double splat (**) #1926

Closed
JuanitoFatas opened this issue May 28, 2015 · 1 comment · Fixed by #1930
Closed

rubocop v0.29.1 crashed when auto-correct hash with double splat (**) #1926

JuanitoFatas opened this issue May 28, 2015 · 1 comment · Fixed by #1930
Assignees
Labels

Comments

@JuanitoFatas
Copy link
Contributor

Given this file:

Hash(foo: 'bar',
  **extra_params
)

when you run: bundle exec rubocop -DR --auto-correct, will yield errors:

$ rcc null/example.rb
Inspecting 1 file

0 files inspected, no offenses detected
undefined method `loc' for nil:NilClass
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/style/align_hash.rb:239:in `block in autocorrect'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/corrector.rb:46:in `call'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/corrector.rb:46:in `block in rewrite'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/corrector.rb:45:in `each'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/corrector.rb:45:in `rewrite'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/team.rb:83:in `autocorrect_one_cop'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/team.rb:65:in `autocorrect'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cop/team.rb:35:in `inspect_file'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:129:in `inspect_file'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:100:in `block in do_inspection_loop'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:94:in `loop'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:94:in `do_inspection_loop'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:72:in `process_file'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:53:in `block in inspect_files'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:51:in `each'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:51:in `inspect_files'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/runner.rb:30:in `run'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/lib/rubocop/cli.rb:24:in `run'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/bin/rubocop:13:in `block in <top (required)>'
/Users/Juan/.rubies/ruby-2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
/Users/Juan/.gem/ruby/2.2.2/gems/rubocop-0.29.1/bin/rubocop:12:in `<top (required)>'
/Users/Juan/.gem/ruby/2.2.2/bin/rubocop:23:in `load'
/Users/Juan/.gem/ruby/2.2.2/bin/rubocop:23:in `<main>'

And for some reason, I cannot upgrade my rubocop (locked at v0.29.1) 😓

Any pointers on how could I fix this? Thanks!

@jonas054 jonas054 added the bug label May 31, 2015
@jonas054
Copy link
Collaborator

The problem is still present on the current master.

@jonas054 jonas054 self-assigned this May 31, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Jun 1, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Jun 2, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Jun 2, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Jun 3, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Jun 4, 2015
rrosenblum added a commit to rrosenblum/rubocop that referenced this issue Jun 5, 2015
bbatsov added a commit that referenced this issue Jun 5, 2015
[Fix #1926] Do not crash when correcting a hash with a splat in it
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.

2 participants