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 Lint/InterpolationCheck #8684

Closed
tas50 opened this issue Sep 10, 2020 · 0 comments · Fixed by #8685
Closed

Error in Lint/InterpolationCheck #8684

tas50 opened this issue Sep 10, 2020 · 0 comments · Fixed by #8685
Labels

Comments

@tas50
Copy link
Contributor

tas50 commented Sep 10, 2020

Expected behavior

Cop runs w/o error

Actual behavior

Error is thrown when scanning:

An error occurred while Lint/InterpolationCheck cop was inspecting /Users/tsmith/dev/the_world/L7-mysql/providers/server.rb:25:42.
Expected a Parser::Source::Range, Comment or Rubocop::AST::Node, got NilClass
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/corrector.rb:92:in `to_range'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/corrector.rb:101:in `check_range_validity'
/usr/local/lib/ruby/gems/2.7.0/gems/parser-2.7.1.4/lib/parser/source/tree_rewriter.rb:371:in `combine'
/usr/local/lib/ruby/gems/2.7.0/gems/parser-2.7.1.4/lib/parser/source/tree_rewriter.rb:194:in `replace'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/lint/interpolation_check.rb:45:in `autocorrect'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/lint/interpolation_check.rb:32:in `block in on_str'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/base.rb:333:in `correct'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/base.rb:126:in `add_offense'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/lint/interpolation_check.rb:31:in `on_str'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:99:in `block (2 levels) in trigger_responding_cops'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:152:in `with_cop_error_handling'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:98:in `block in trigger_responding_cops'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:97:in `each'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:97:in `trigger_responding_cops'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:70:in `on_str'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `block in on_array'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `on_array'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_array'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:116:in `block in on_send'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:113:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:113:in `each_with_index'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:113:in `on_send'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_send'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:169:in `on_block'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_block'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `block in on_begin'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `on_begin'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_begin'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:173:in `on_block'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_block'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `block in on_begin'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `each'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:59:in `on_begin'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_begin'
/usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.3.0/lib/rubocop/ast/traversal.rb:14:in `walk'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:85:in `investigate'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/team.rb:152:in `investigate_partial'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/team.rb:83:in `investigate'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:299:in `inspect_file'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:249:in `block in do_inspection_loop'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:281:in `block in iterate_until_no_changes'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:274:in `loop'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:274:in `iterate_until_no_changes'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:245:in `do_inspection_loop'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:125:in `block in file_offenses'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:150:in `file_offense_cache'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:124:in `file_offenses'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:115:in `process_file'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:94:in `block in each_inspected_file'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:93:in `each'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:93:in `reduce'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:93:in `each_inspected_file'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:79:in `inspect_files'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:40:in `run'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/command/execute_runner.rb:22:in `execute_runner'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/command/execute_runner.rb:14:in `run'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/command.rb:11:in `run'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/environment.rb:18:in `run'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cli.rb:65:in `run_command'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/tsmith/dev/oss/rubocop/lib/rubocop/cli.rb:41:in `run'
/Users/tsmith/dev/oss/rubocop/exe/rubocop:13:in `block in <top (required)>'
/usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/Users/tsmith/dev/oss/rubocop/exe/rubocop:12:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/bin/rubocop:23:in `load'
/usr/local/lib/ruby/gems/2.7.0/bin/rubocop:23:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/opt/ruby/bin/bundle:23:in `load'
/usr/local/opt/ruby/bin/bundle:23:in `<main>'

Steps to reproduce the problem

Scan this ruby:

  %w("#{new_resource.name}-binlogcleaner" "#{new_resource.name}-monitoring").each do |cron|
    cron_d cron do
      action :delete
    end
  end

RuboCop version

Master

0.90.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.7.1 x86_64-darwin19)
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