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

[Ruby 2.0] ** operator causes errors in two cops #322

Closed
jurriaan opened this issue Jul 2, 2013 · 1 comment
Closed

[Ruby 2.0] ** operator causes errors in two cops #322

jurriaan opened this issue Jul 2, 2013 · 1 comment

Comments

@jurriaan
Copy link
Contributor

jurriaan commented Jul 2, 2013

I get errors in ruby files using the double star operator (**)

def test(**options)
  p options
end
test(a: 1)
1 file inspected, no offences detected

2 errors occurred:
An error occurred while ShadowingOuterLocalVariable cop was inspecting test.rb.
An error occurred while UnusedLocalVariable cop was inspecting 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.9.0 (using Parser 2.0.0.beta9, running on ruby 2.0.0 x86_64-darwin12.4.0)

Debug output:

An error occurred while ShadowingOuterLocalVariable cop was inspecting  /path/to/test.rb.
Using undeclared local variable "options" at  /path/to/test.rb:2:5, (lvar :options)
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:203:in `process_node'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:181:in `block in inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:140:in `block (2 levels) in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `catch'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `block in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:144:in `block (2 levels) in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `catch'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `block in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:125:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:171:in `inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:255:in `process_node'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:181:in `block in inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:140:in `block (2 levels) in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `catch'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `block in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:125:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:171:in `inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:164:in `inspect_variables'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb:16:in `inspect'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:102:in `block in inspect_file'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `reduce'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `inspect_file'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:55:in `block in run'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:49:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:49:in `run'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/bin/rubocop:14:in `block in <top (required)>'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/bin/rubocop:13:in `<top (required)>'
/usr/local/bin/rubocop:23:in `load'
/usr/local/bin/rubocop:23:in `<main>'
An error occurred while UnusedLocalVariable cop was inspecting /path/to/test.rb.
Using undeclared local variable "options" at /path/to/test.rb:2:5, (lvar :options)
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:203:in `process_node'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:181:in `block in inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:140:in `block (2 levels) in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `catch'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `block in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:144:in `block (2 levels) in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `catch'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `block in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:125:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:171:in `inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:255:in `process_node'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:181:in `block in inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:140:in `block (2 levels) in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `catch'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:139:in `block in scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:133:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:125:in `scan_nodes_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:171:in `inspect_variables_in_scope'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/variable_inspector.rb:164:in `inspect_variables'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cop/lint/unused_local_variable.rb:17:in `inspect'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:102:in `block in inspect_file'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `reduce'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:96:in `inspect_file'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:55:in `block in run'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:49:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/lib/rubocop/cli.rb:49:in `run'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/bin/rubocop:14:in `block in <top (required)>'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rubocop-0.9.0/bin/rubocop:13:in `<top (required)>'
/usr/local/bin/rubocop:23:in `load'
/usr/local/bin/rubocop:23:in `<main>'
@bbatsov
Copy link
Collaborator

bbatsov commented Jul 2, 2013

I guess @yujinakayama will have a look at this soon.

yujinakayama added a commit that referenced this issue Jul 2, 2013
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