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

An error occurred while Lint/SuppressedException cop was inspecting #8008

Closed
ruanltbg opened this issue May 21, 2020 · 0 comments
Closed

An error occurred while Lint/SuppressedException cop was inspecting #8008

ruanltbg opened this issue May 21, 2020 · 0 comments
Labels
bug

Comments

@ruanltbg
Copy link

@ruanltbg ruanltbg commented May 21, 2020

After upgrading rubocop to 0.84.0 the command rubocop started to raise an error as:
An error occurred while Lint/SuppressedException cop was inspecting.


Expected behavior

To run normally.

Actual behavior

It runs, but for a piece of code it generates an error.

Steps to reproduce the problem

Create a file with this code:

def delete
  indicies.each { |index| indice.delete(INDEX_NAMES[index]) }
rescue ::Elasticsearch::Transport::Transport::Errors::NotFound
end

run rubocop.
It is going to generate this error:

An error occurred while Lint/SuppressedException cop was inspecting /Users/ruan/workspace/projects/wikiposit/lib/quandl/elasticsearch/helpers.rb:18:6.
bad value for range
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/lint/suppressed_exception.rb:85:in `comment_between_rescue_and_end?'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/lint/suppressed_exception.rb:72:in `on_resbody'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:57:in `block (2 levels) in trigger_responding_cops'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:136:in `with_cop_error_handling'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:56:in `block in trigger_responding_cops'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:55:in `each'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:55:in `trigger_responding_cops'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:32:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:176:in `block in on_case'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:175:in `each'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:175:in `on_case'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:107:in `on_def'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `block in on_begin'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `each'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `on_begin'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:99:in `on_class'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:157:in `on_while'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:157:in `on_while'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `block in on_begin'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `each'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `on_begin'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:14:in `walk'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/commissioner.rb:44:in `investigate'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/team.rb:124:in `investigate'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/team.rb:112:in `offenses'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cop/team.rb:44:in `inspect_file'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:295:in `inspect_file'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:245:in `block in do_inspection_loop'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:277:in `block in iterate_until_no_changes'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:270:in `loop'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:270:in `iterate_until_no_changes'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:241:in `do_inspection_loop'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:122:in `block in file_offenses'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:146:in `file_offense_cache'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:120:in `file_offenses'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:111:in `process_file'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:90:in `block in each_inspected_file'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:89:in `each'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:89:in `reduce'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:89:in `each_inspected_file'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:78:in `inspect_files'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/runner.rb:39:in `run'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cli/command/execute_runner.rb:21:in `execute_runner'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cli/command/execute_runner.rb:13:in `run'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cli/command.rb:10:in `run'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cli/environment.rb:17:in `run'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cli.rb:65:in `run_command'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/lib/rubocop/cli.rb:41:in `run'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/exe/rubocop:13:in `block in <top (required)>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/rubocop-0.84.0/exe/rubocop:12:in `<top (required)>'
/Users/ruan/.rbenv/versions/2.4.5/bin/rubocop:23:in `load'
/Users/ruan/.rbenv/versions/2.4.5/bin/rubocop:23:in `<top (required)>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/ruan/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/Users/ruan/.rbenv/versions/2.4.5/bin/bundle:23:in `load'
/Users/ruan/.rbenv/versions/2.4.5/bin/bundle:23:in `<main>'

RuboCop version

0.84.0 (using Parser 2.7.1.2, rubocop-ast 0.0.3, running on ruby 2.4.5 x86_64-darwin19)
@koic koic added the bug label May 22, 2020
koic added a commit to koic/rubocop that referenced this issue May 22, 2020
Fixes rubocop-hq#8008.

This PR fixes an error for `Lint/SuppressedException`
when empty rescue block in `def`.
bbatsov added a commit that referenced this issue May 22, 2020
Fixes #8008.

This PR fixes an error for `Lint/SuppressedException`
when empty rescue block in `def`.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue May 23, 2020
Due to rubocop-hq/rubocop#8008 this commit pins
rubocop to 0.83.0 until the fix is release in 0.85.0.
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Jun 14, 2020
Due to rubocop-hq/rubocop#8008 this commit pins
rubocop to 0.83.0 until the fix is release in 0.85.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.