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 Style/GuardClause cop was inspecting #11860

Closed
arod1010 opened this issue May 8, 2023 · 1 comment
Closed

An error occurred while Style/GuardClause cop was inspecting #11860

arod1010 opened this issue May 8, 2023 · 1 comment

Comments

@arod1010
Copy link

arod1010 commented May 8, 2023

While inspecting my migration file, I received the following error:

An error occurred while Style/GuardClause cop was inspecting
undefined method `heredoc?' for #RuboCop::AST::HashNode:0x00007ff720aad448

Mention the following information in the issue report:
1.40.0 (using Parser 3.2.1.0, rubocop-ast 1.24.0, running on ruby 2.7.7) [x86_64-darwin21]
Finished in 0.28701400000136346 seconds

Expected behavior

No violations found

Actual behavior

An error occurred while Style/GuardClause cop was inspecting
undefined method heredoc?' for #<RuboCop::AST::HashNode:0x00007fe496bca7f0> /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/style/guard_clause.rb:190:in autocorrect'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/style/guard_clause.rb:179:in block in register_offense' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/base.rb:346:in correct'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/base.rb:127:in add_offense' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/style/guard_clause.rb:176:in register_offense'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/style/guard_clause.rb:149:in check_ending_if' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/style/guard_clause.rb:137:in check_ending_body'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/style/guard_clause.rb:109:in on_def' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:100:in public_send'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:100:in block (2 levels) in trigger_responding_cops' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:160:in with_cop_error_handling'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:99:in block in trigger_responding_cops' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:98:in each'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:98:in trigger_responding_cops' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:69:in on_def'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-ast-1.24.0/lib/rubocop/ast/traversal.rb:137:in block in on_dstr' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-ast-1.24.0/lib/rubocop/ast/traversal.rb:137:in each'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-ast-1.24.0/lib/rubocop/ast/traversal.rb:137:in on_dstr' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:71:in on_begin'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-ast-1.24.0/lib/rubocop/ast/traversal.rb:154:in on_class' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:71:in on_class'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-ast-1.24.0/lib/rubocop/ast/traversal.rb:20:in walk' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/commissioner.rb:86:in investigate'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/team.rb:154:in investigate_partial' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cop/team.rb:82:in investigate'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:315:in inspect_file' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:259:in block in do_inspection_loop'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:293:in block in iterate_until_no_changes' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:286:in loop'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:286:in iterate_until_no_changes' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:255:in do_inspection_loop'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:138:in block in file_offenses' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:163:in file_offense_cache'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:137:in file_offenses' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:128:in process_file'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:109:in block in each_inspected_file' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:108:in each'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:108:in reduce' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:108:in each_inspected_file'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:94:in inspect_files' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/runner.rb:47:in run'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli/command/execute_runner.rb:26:in block in execute_runner' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli/command/execute_runner.rb:52:in with_redirect'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli/command/execute_runner.rb:25:in execute_runner' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli/command/execute_runner.rb:17:in run'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli/command.rb:11:in run' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli/environment.rb:18:in run'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli.rb:72:in run_command' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli.rb:79:in execute_runners'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/lib/rubocop/cli.rb:48:in run' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/exe/rubocop:19:in block in <top (required)>'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/2.7.0/benchmark.rb:308:in realtime' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/rubocop-1.40.0/exe/rubocop:19:in <top (required)>'
/<REDACTED/.rbenv/versions/2.7.7/bin/rubocop:23:in load' /<REDACTED/.rbenv/versions/2.7.7/bin/rubocop:23:in <top (required)>'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:58:in load' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:58:in kernel_load'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:23:in run' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/cli.rb:477:in exec'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/cli.rb:31:in dispatch'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/cli.rb:25:in start'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/exe/bundle:49:in block in <top (required)>' /<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/friendly_errors.rb:128:in with_friendly_errors'
/<REDACTED/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/exe/bundle:37:in <top (required)>' /<REDACTED/.rbenv/versions/2.7.7/bin/bundle:23:in load'
/<REDACTED/.rbenv/versions/2.7.7/bin/bundle:23:in `

'

Steps to reproduce the problem

This happened in a migration file

RuboCop version

1.40.0 (using Parser 3.2.1.0, rubocop-ast 1.24.0, running on ruby 2.7.7) [x86_64-darwin21]

  • rubocop-rspec 2.16.0
@koic
Copy link
Member

koic commented May 9, 2023

This issue may be resolved by #11307. Please upgrade RuboCop to the latest version (1.50.2).

@koic koic closed this as completed May 9, 2023
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

2 participants