Skip to content

An error occurred while Style/EvalWithLocation cop #9479

@DirtyF

Description

@DirtyF

Expected behavior

rubocop to exit without errors

Actual behavior

rubocop exit with error:

1 error occurred:
An error occurred while Style/EvalWithLocation cop was inspecting /jekyll/jekyll/lib/jekyll/commands/serve.rb:183:12.
Errors are usually caused by RuboCop bugs.

Source code: https://github.com/jekyll/jekyll/blob/master/lib/jekyll/commands/serve.rb#L183

Debug trace:

.Scanning /Users/frank/code/jekyll/jekyll/lib/jekyll/commands/serve.rb
An error occurred while Style/EvalWithLocation cop was inspecting /Users/frank/code/jekyll/jekyll/lib/jekyll/commands/serve.rb:183:12.
undefined method `str_type?' for nil:NilClass
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/style/eval_with_location.rb:67:in `on_send'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:136:in `public_send'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:136:in `block (2 levels) in trigger_restricted_cops'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:166:in `with_cop_error_handling'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:135:in `block in trigger_restricted_cops'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:134:in `each'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:134:in `trigger_restricted_cops'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:70:in `on_send'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:154:in `on_block'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_block'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:155:in `on_if'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_if'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `each'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:154:in `on_def'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_def'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `each'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:138:in `on_while'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_sclass'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `each'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:154:in `on_class'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_class'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:138:in `on_while'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_module'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:138:in `on_while'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:71:in `on_module'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-ast-1.4.1/lib/rubocop/ast/traversal.rb:20:in `walk'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/commissioner.rb:86:in `investigate'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/team.rb:157:in `investigate_partial'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cop/team.rb:83:in `investigate'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:315:in `inspect_file'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:259:in `block in do_inspection_loop'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:293:in `block in iterate_until_no_changes'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:286:in `loop'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:286:in `iterate_until_no_changes'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:255:in `do_inspection_loop'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:132:in `block in file_offenses'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:157:in `file_offense_cache'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:131:in `file_offenses'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:122:in `process_file'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:100:in `each'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:100:in `reduce'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:100:in `each_inspected_file'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:86:in `inspect_files'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/runner.rb:47:in `run'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli/command.rb:11:in `run'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli/environment.rb:18:in `run'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli.rb:65:in `run_command'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli.rb:72:in `execute_runners'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/lib/rubocop/cli.rb:41:in `run'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/exe/rubocop:13:in `block in <top (required)>'
/Users/frank/.rbenv/versions/2.7.2/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/gems/rubocop-1.9.0/exe/rubocop:12:in `<top (required)>'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/bin/rubocop:23:in `load'
/Users/frank/code/jekyll/jekyll/vendor/bundle/ruby/2.7.0/bin/rubocop:23:in `<top (required)>'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:63:in `load'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:28:in `run'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/cli.rb:494:in `exec'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/cli.rb:30:in `dispatch'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/cli.rb:24:in `start'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/exe/bundle:49:in `block in <top (required)>'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
/Users/frank/.gem/ruby/2.7.0/gems/bundler-2.2.7/exe/bundle:37:in `<top (required)>'
/Users/frank/.rbenv/versions/2.7.2/bin/bundle:23:in `load'
/Users/frank/.rbenv/versions/2.7.2/bin/bundle:23:in `<main>'

Steps to reproduce the problem

gh repo clone jekyl/jekyll
bundle update
bundle exec rubocop -D

RuboCop version

1.9.0 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 2.7.2 x86_64-darwin19)

It was exiting fine with previous rubocop version. Same errors occurs with Ruby 3.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions