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

Exception in Style/RedundantDoubleSplatHashBraces #12275

Closed
zverok opened this issue Oct 13, 2023 · 4 comments · Fixed by #12278 or #12326
Closed

Exception in Style/RedundantDoubleSplatHashBraces #12275

zverok opened this issue Oct 13, 2023 · 4 comments · Fixed by #12278 or #12326
Labels

Comments

@zverok
Copy link
Contributor

zverok commented Oct 13, 2023

A specific pattern in code breaks Style/RedundantDoubleSplatHashBraces. This is a minimal reproducible example (yes, this somewhat weird, and real production code was even more peculiar, but still):

{**%w[foo].to_h { |key| [key, bar: :baz] }}

Expected behavior

At least no exception. And probably nothing reasonable to recommend here (at least by that cop).

Actual behavior

$ rubocop --only Style/RedundantDoubleSplatHashBraces test.rb --debug
For /home/zverok/playground/ruby/rubocop-debug: configuration from /home/zverok/playground/ruby/rubocop-debug/.rubocop.yml
Default configuration from /home/zverok/.rvm/gems/ruby-2.7.3/gems/rubocop-1.57.1/config/default.yml
AllCops/Exclude configuration from /home/zverok/playground/ruby/.rubocop.yml
Use parallel by default.
Skipping parallel inspection: only a single file needs inspection
Inspecting 1 file
Scanning /home/zverok/playground/ruby/rubocop-debug/test.rb
An error occurred while Style/RedundantDoubleSplatHashBraces cop was inspecting /home/zverok/playground/ruby/rubocop-debug/test.rb:1:30.
undefined method `join' for nil:NilClass
/home/zverok/.rvm/gems/ruby-2.7.3/gems/rubocop-1.57.1/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb:79:in `opening_brace'
/home/zverok/.rvm/gems/ruby-2.7.3/gems/rubocop-1.57.1/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb:54:in `autocorrect'
/home/zverok/.rvm/gems/ruby-2.7.3/gems/rubocop-1.57.1/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb:37:in `block in on_hash'
/home/zverok/.rvm/gems/ruby-2.7.3/gems/rubocop-1.57.1/lib/rubocop/cop/base.rb:377:in `correct'
# ...and so on...

Steps to reproduce the problem

Just running Rubocop on a file containing the line above.

RuboCop version

$ [bundle exec] rubocop -V
1.57.1 (using Parser 3.2.2.4, rubocop-ast 1.29.0, running on ruby 2.7.3) [x86_64-linux]
@koic koic added the bug label Oct 13, 2023
koic added a commit to koic/rubocop that referenced this issue Oct 13, 2023
…latHashBraces`

Fixes rubocop#12275.

This PR fixes a false positive for `Style/RedundantDoubleSplatHashBraces`
when using double splat within block argument containing a hash literal in an array literal.
bbatsov pushed a commit that referenced this issue Oct 14, 2023
…Braces`

Fixes #12275.

This PR fixes a false positive for `Style/RedundantDoubleSplatHashBraces`
when using double splat within block argument containing a hash literal in an array literal.
@mathieujobin
Copy link

Getting a crash on this cop

$ be rubocop --only Style/RedundantDoubleSplatHashBraces -d app/models/concerns/active_record/
For /home/mathieu/work/payrollhero/core_app: configuration from /home/mathieu/work/payrollhero/core_app/.rubocop.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-capybara-2.19.0/config/default.yml
Default configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-capybara-2.19.0/lib/../config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-factory_bot-2.24.0/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-factory_bot-2.24.0/lib/../config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-performance-1.19.1/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-performance-1.19.1/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-rails-2.22.1/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-rails-2.22.1/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-rspec-2.25.0/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-rspec-2.25.0/config/default.yml
configuration from /home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-thread_safety-0.5.1/config/default.yml
configuration from #{path}
Inheriting configuration from /home/mathieu/work/payrollhero/core_app/.rubocop_todo.yml
Inspecting 17 files
Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/destruction_not_allowed_error.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/ids_assignment_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/mass_destruction_support.rb
An error occurred while Style/RedundantDoubleSplatHashBraces cop was inspecting /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/mass_destruction_support.rb:33:40.
undefined method `join' for nil:NilClass
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb:82:in `opening_brace'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb:57:in `autocorrect'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb:38:in `block in on_hash'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/base.rb:377:in `correct'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/base.rb:181:in `add_offense'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb:37:in `on_hash'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:107:in `public_send'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:107:in `block (2 levels) in trigger_responding_cops'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:171:in `with_cop_error_handling'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:106:in `block in trigger_responding_cops'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:105:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:105:in `trigger_responding_cops'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:69:in `on_hash'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:159:in `block in on_send'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:156:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:156:in `each_with_index'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:156:in `on_send'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_send'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:128:in `on_splat'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_kwsplat'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_hash'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:159:in `block in on_send'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:156:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:156:in `each_with_index'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:156:in `on_send'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_send'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:154:in `on_def'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_def'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:138:in `on_while'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_module'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_begin'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:138:in `on_while'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:71:in `on_module'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-ast-1.30.0/lib/rubocop/ast/traversal.rb:20:in `walk'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/commissioner.rb:87:in `investigate'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/team.rb:156:in `investigate_partial'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/team.rb:98:in `investigate'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:345:in `block in inspect_file'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:344:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:344:in `flat_map'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:344:in `inspect_file'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:287:in `block in do_inspection_loop'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:321:in `block in iterate_until_no_changes'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:314:in `loop'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:314:in `iterate_until_no_changes'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:283:in `do_inspection_loop'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:164:in `block in file_offenses'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:189:in `file_offense_cache'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:163:in `file_offenses'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:154:in `process_file'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:135:in `block in each_inspected_file'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:134:in `each'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:134:in `reduce'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:134:in `each_inspected_file'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:120:in `inspect_files'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/runner.rb:73:in `run'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli/command.rb:11:in `run'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli/environment.rb:18:in `run'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli.rb:118:in `run_command'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli.rb:125:in `execute_runners'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli.rb:51:in `block in run'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli.rb:77:in `profile_if_needed'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cli.rb:43:in `run'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/exe/rubocop:19:in `block in <top (required)>'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/gems/rubocop-1.57.2/exe/rubocop:19:in `<top (required)>'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/bin/rubocop:25:in `load'
/home/mathieu/work/payrollhero/core_app/vendor/gems/ruby/3.2.0/bin/rubocop:25:in `<top (required)>'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:492:in `exec'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/cli.rb:28:in `start'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/exe/bundle:37:in `block in <top (required)>'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/home/mathieu/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.21/exe/bundle:29:in `<top (required)>'
/home/mathieu/.asdf/installs/ruby/3.2.2/bin/bundle:25:in `load'
/home/mathieu/.asdf/installs/ruby/3.2.2/bin/bundle:25:in `<main>'
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/normalized_blank_attributes_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/parent_specific_id_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/protect_dependent.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/randomized_attachment_filename.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/readonly_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/referential_integrity_protection_error.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/reload_callback_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/serialize_with_marshal.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/temporal_attribute_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/temporal_record_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/transaction_avoidance_support.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/union_scope_finders.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/variants.rb
.Scanning /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/zero_transactions_support.rb
.

17 files inspected, no offenses detected

1 error occurred:
An error occurred while Style/RedundantDoubleSplatHashBraces cop was inspecting /home/mathieu/work/payrollhero/core_app/app/models/concerns/active_record/mass_destruction_support.rb:33:40.
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.57.2 (using Parser 3.2.2.4, rubocop-ast 1.30.0, running on ruby 3.2.2) [x86_64-linux]
Finished in 1.6031748779932968 seconds

@koic
Copy link
Member

koic commented Oct 31, 2023

@mathieujobin Can you provide a repro code?

@mathieujobin
Copy link

    def has_second_order_dependents(symbol, dependent: :delete_all, through:, **options)
      if dependent != :delete_all
        raise ArgumentError, "You may only use dependent: :delete_all with has_many_dependent_through."
      end
      before_destroy -> { delete_through_association(send(symbol)) }
      has_many symbol, **(options.merge(through: through)) # <<< this line
    end

@koic
Copy link
Member

koic commented Oct 31, 2023

I've opened #12326 to prevent the error. Thanks!

koic added a commit to koic/rubocop that referenced this issue Oct 31, 2023
Fixes rubocop#12275 (comment).

This PR fixes an error for `Style/RedundantDoubleSplatHashBraces`
when method call for parenthesized no hash double double splat.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants