You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've experienced this bug with the Style/RedundantFetchBlock cop today, and it suggested to make a bug report, so here I am.
Expected behavior
Rubocop doesn't throw exception
Actual behavior
1 error occurred:
An error occurred while Style/RedundantFetchBlock cop was inspecting -file-
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop-hq/rubocop/issues
Mention the following information in the issue report:
0.86.0 (using Parser 2.7.1.4, rubocop-ast 0.0.3, running on ruby 2.6.4 x86_64-darwin19)
Finished in 1.0352169999969192 seconds
Steps to reproduce the problem
be rubocop -d file
I can't disclose the source file here, but I can try and whittle down a failing case from it if you need it
Backtrace
An error occurred while Style/RedundantFetchBlock cop was inspecting {{file}}
undefined method `basic_literal?' for nil:NilClass
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/style/redundant_fetch_block.rb:76:in `basic_literal?'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/style/redundant_fetch_block.rb:52:in `redundant_fetch_block_candidate?'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/style/redundant_fetch_block.rb:48:in `on_block'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:56:in `block (2 levels) in trigger_responding_cops'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:115:in `with_cop_error_handling'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:55:in `block in trigger_responding_cops'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:54:in `each'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:54:in `trigger_responding_cops'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:32:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:114:in `block in on_send'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:111:in `each'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:111:in `each_with_index'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:111:in `on_send'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `block in on_begin'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `each'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `on_begin'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:171:in `on_block'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `block in on_kwbegin'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `each'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `on_kwbegin'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `block in on_or_asgn'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `each'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `on_or_asgn'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:107:in `on_def'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `block in on_begin'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `each'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:57:in `on_begin'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:99:in `on_class'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:157:in `on_while'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:33:in `block (2 levels) in <class:Commissioner>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-ast-0.0.3/lib/rubocop/ast/traversal.rb:14:in `walk'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/commissioner.rb:43:in `investigate'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/team.rb:149:in `investigate'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/team.rb:137:in `offenses'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cop/team.rb:75:in `inspect_file'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:299:in `inspect_file'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:247:in `block in do_inspection_loop'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:279:in `block in iterate_until_no_changes'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:272:in `loop'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:272:in `iterate_until_no_changes'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:243:in `do_inspection_loop'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:122:in `block in file_offenses'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:146:in `file_offense_cache'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:120:in `file_offenses'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:111:in `process_file'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:90:in `block in each_inspected_file'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:89:in `each'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:89:in `reduce'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:89:in `each_inspected_file'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:78:in `inspect_files'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/runner.rb:39:in `run'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cli/command/execute_runner.rb:21:in `execute_runner'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cli/command/execute_runner.rb:13:in `run'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cli/command.rb:10:in `run'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cli/environment.rb:17:in `run'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cli.rb:65:in `run_command'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cli.rb:72:in `execute_runners'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/lib/rubocop/cli.rb:41:in `run'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/exe/rubocop:13:in `block in <top (required)>'
~/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/rubocop-0.86.0/exe/rubocop:12:in `<top (required)>'
~/.rbenv/versions/2.6.4/bin/rubocop:23:in `load'
~/.rbenv/versions/2.6.4/bin/rubocop:23:in `<top (required)>'
Hi there,
I've experienced this bug with the
Style/RedundantFetchBlock
cop today, and it suggested to make a bug report, so here I am.Expected behavior
Rubocop doesn't throw exception
Actual behavior
Steps to reproduce the problem
be rubocop -d file
I can't disclose the source file here, but I can try and whittle down a failing case from it if you need it
Backtrace
I've redacted parts that weren't relevant
RuboCop version
``
$ bundle exec rubocop -V
0.86.0 (using Parser 2.7.1.4, rubocop-ast 0.0.3, running on ruby 2.6.4 x86_64-darwin19)
The text was updated successfully, but these errors were encountered: