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

Error in UselessSetterCall cop #1649

Closed
doy opened this issue Feb 11, 2015 · 0 comments
Closed

Error in UselessSetterCall cop #1649

doy opened this issue Feb 11, 2015 · 0 comments

Comments

@doy
Copy link

doy commented Feb 11, 2015

Given the file:

def foo(bar)
  begin
  rescue StandardError => _
  end
  bar[:baz] = true
end

I get this output from rubocop -d rubocop_error.rb:

An error occurred while Lint/UselessSetterCall cop was inspecting /home/jesse-luehrs/rubocop_error.rb.

1 error occurred:
An error occurred while Lint/UselessSetterCall cop was inspecting /home/jesse-luehrs/rubocop_error.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.28.0 (using Parser 2.2.0.2, running on ruby 2.1.5 x86_64-linux)
Inspecting 1 file
Scanning /home/jesse-luehrs/rubocop_error.rb
For /home/jesse-luehrs: configuration from /home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/config/default.yml
Inheriting configuration from /home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/config/enabled.yml
Inheriting configuration from /home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/config/disabled.yml
undefined method `type' for nil:NilClass
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:139:in `process_assignment'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:83:in `block in contain_local_object?'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:92:in `block in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `catch'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:95:in `block (2 levels) in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:141:in `block in each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:94:in `block in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `catch'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:95:in `block (2 levels) in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:141:in `block in each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:94:in `block in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `catch'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:95:in `block (2 levels) in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:141:in `block in each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:94:in `block in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `catch'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:95:in `block (2 levels) in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:141:in `block in each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/astrolabe-1.3.0/lib/astrolabe/node.rb:139:in `each_child_node'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:94:in `block in scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `catch'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:91:in `scan'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:73:in `contain_local_object?'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/lint/useless_setter_call.rb:46:in `on_method_def'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/mixin/on_method_def.rb:9:in `on_def'
(eval):5:in `block (2 levels) in on_def'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/commissioner.rb:92:in `with_cop_error_handling'
(eval):4:in `block in on_def'
(eval):2:in `each'
(eval):2:in `on_def'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/ast-1.1.0/lib/ast/processor.rb:239:in `process'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/commissioner.rb:52:in `investigate'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cop/team.rb:33:in `inspect_file'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:92:in `inspect_file'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:76:in `block in do_inspection_loop'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:71:in `loop'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:71:in `do_inspection_loop'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:58:in `process_file'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:27:in `block in run'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:25:in `each'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/runner.rb:25:in `run'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/lib/rubocop/cli.rb:24:in `run'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/bin/rubocop:13:in `block in <top (required)>'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/home/jesse-luehrs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rubocop-0.28.0/bin/rubocop:12:in `<top (required)>'
/home/jesse-luehrs/.rbenv/versions/2.1/bin/rubocop:23:in `load'
/home/jesse-luehrs/.rbenv/versions/2.1/bin/rubocop:23:in `<main>'
W

Offenses:

rubocop_error.rb:3:3: W: Lint/HandleExceptions: Do not suppress exceptions.
  rescue StandardError => _
  ^^^^^^^^^^^^^^^^^^^^^^^^^
rubocop_error.rb:3:3: C: Style/IndentationWidth: Use 2 (not 0) spaces for indentation.
  rescue StandardError => _


1 file inspected, 2 offenses detected
Finished in 0.017217432 seconds

This seems possibly related to #1026.

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

1 participant