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

Style/SuperArguments bug #13010

Closed
krystof-k opened this issue Jun 21, 2024 · 0 comments · Fixed by #13011
Closed

Style/SuperArguments bug #13010

krystof-k opened this issue Jun 21, 2024 · 0 comments · Fixed by #13011
Labels

Comments

@krystof-k
Copy link

krystof-k commented Jun 21, 2024

I'm getting an error related to Style/SuperArguments in the latest Rubocop.

Probably caused by this monkey-patch?

  def link_to(name = nil, options = nil, html_options = {}, &block)
    if options != '#'
      parser = URI::Parser.new
      if URI.parse(parser.escape(url_for(options))).path != '/' && request&.original_url.present?
        unless turbo(request.original_url, URI.parse(parser.escape(url_for(options))).path)
          puts html_options[:data] ||= {}
          html_options[:data]['turbo'] = false
        end
      end
    end

    super(name, options, html_options, &block)
  end

Expected behavior

It doesn't fail.

Actual behavior

It fails.

Trace
Scanning /app/app/helpers/application_helper.rb
An error occurred while Style/SuperArguments cop was inspecting /app/app/helpers/application_helper.rb:63:4.
undefined method `name' for s(:send,
  s(:lvar, :html_options), :[],
  s(:sym, :data)):RuboCop::AST::SendNode
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/op_asgn_node.rb:18:in `name'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:130:in `block in block_reassigned?'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:111:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:112:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:112:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:112:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:112:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:112:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:112:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:112:in `block in visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:108:in `visit_descendants'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/node/mixin/descendence.rb:100:in `each_node'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:129:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:129:in `any?'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:129:in `block_reassigned?'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:123:in `block_arg_same?'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:71:in `block in arguments_identical?'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:66:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:66:in `arguments_identical?'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/style/super_arguments.rb:53:in `on_super'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:107:in `public_send'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:107:in `block (2 levels) in trigger_responding_cops'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:171:in `with_cop_error_handling'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:106:in `block in trigger_responding_cops'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:105:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:105:in `trigger_responding_cops'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:69:in `on_super'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:137:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:154:in `on_def'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:71:in `on_def'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:137:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:138:in `on_while'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:71:in `on_module'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-ast-1.31.3/lib/rubocop/ast/traversal.rb:20:in `walk'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/commissioner.rb:87:in `investigate'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/team.rb:156:in `investigate_partial'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cop/team.rb:98:in `investigate'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:349:in `block in inspect_file'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:348:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:348:in `flat_map'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:348:in `inspect_file'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:291:in `block in do_inspection_loop'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:325:in `block in iterate_until_no_changes'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:318:in `loop'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:318:in `iterate_until_no_changes'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:287:in `do_inspection_loop'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:168:in `block in file_offenses'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:193:in `file_offense_cache'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:167:in `file_offenses'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:158:in `process_file'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:139:in `block in each_inspected_file'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:138:in `each'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:138:in `reduce'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:138:in `each_inspected_file'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:124:in `inspect_files'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/runner.rb:77:in `run'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/app/vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/app/vendor/bundle/ruby/3.2.0/gems/standard-1.37.0/lib/standard/runners/rubocop.rb:15:in `call'
/app/vendor/bundle/ruby/3.2.0/gems/standard-1.37.0/lib/standard/cli.rb:14:in `run'
/app/vendor/bundle/ruby/3.2.0/gems/standard-1.37.0/exe/standardrb:7:in `<top (required)>'
/app/vendor/bundle/ruby/3.2.0/bin/standardrb:25:in `load'
/app/vendor/bundle/ruby/3.2.0/bin/standardrb:25:in `<top (required)>'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/cli.rb:492:in `exec'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/cli.rb:28:in `start'
/usr/local/bundle/gems/bundler-2.4.8/exe/bundle:45:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.4.8/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.4.8/exe/bundle:33:in `<top (required)>'
/usr/local/bundle/bin/bundle:25:in `load'
/usr/local/bundle/bin/bundle:25:in `<main>'

1 error occurred:
An error occurred while Style/SuperArguments cop was inspecting /app/app/helpers/application_helper.rb:63:4.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
/~https://github.com/rubocop/rubocop/issues

Mention the following information in the issue report:
1.64.1 (using Parser 3.3.3.0, rubocop-ast 1.31.3, running on ruby 3.2.3) [aarch64-linux-musl]

RuboCop version

1.64.1 (using Parser 3.3.3.0, rubocop-ast 1.31.3, running on ruby 3.2.3) [aarch64-linux-musl]
@koic koic added the bug label Jun 21, 2024
koic added a commit to koic/rubocop that referenced this issue Jun 21, 2024
Fixes rubocop#13010.

This PR fixes an error for `Style/SuperArguments`
when the hash argument is or-assigned.
@koic koic closed this as completed in 22d390e Jun 26, 2024
koic added a commit that referenced this issue Jun 26, 2024
…ments

[Fix #13010] Fix an error for `Style/SuperArguments`
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