You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My apologies if this was already fixed by #12278, but I don't think it is (and it doesn't match any of the test cases there). It's related to #12278, at any rate!
Expected behavior
It should not report an offense, the double splat is not redundant in these examples. And it especially should not autocorrect to invalid syntax.
Actual behavior
$ bin/rubocop tmp/rubocop-example.rb -AInspecting 1 fileFOffenses:tmp/rubocop-example.rb:3:5: C: [Corrected] Style/RedundantDoubleSplatHashBraces: Remove the redundant double splat and braces, use keyword arguments directly.foo(**(bar ? {bar:} : {})) ^^^^^^^^^^^^^^^^^^^^^tmp/rubocop-example.rb:3:17: F: Lint/Syntax: unexpected token tCOLON(Using Ruby 3.1 parser; configure using TargetRubyVersion parameter, under AllCops)foo((bar ? bar: : {})) ^tmp/rubocop-example.rb:4:11: C: [Corrected] Style/RedundantDoubleSplatHashBraces: Remove the redundant double splat and braces, use keyword arguments directly.foo(bar:, **(baz ? {baz:} : {})) ^^^^^^^^^^^^^^^^^^^^^tmp/rubocop-example.rb:4:23: F: Lint/Syntax: unexpected token tCOLON(Using Ruby 3.1 parser; configure using TargetRubyVersion parameter, under AllCops)foo(bar:, (baz ? baz: : {})) ^tmp/rubocop-example.rb:4:28: F: Lint/Syntax: unexpected token tRPAREN(Using Ruby 3.1 parser; configure using TargetRubyVersion parameter, under AllCops)foo(bar:, (baz ? baz: : {})) ^1 file inspected, 5 offenses detected, 2 offenses corrected
…atHashBraces`
Fixesrubocop#12286.
This PR fix false positives for `Style/RedundantDoubleSplatHashBraces`
when using double splat with a hash literal enclosed in parenthesized ternary operator.
rubocop 1.57.1 incorrectly identifies and incorrectly autocorrects the following code:
My apologies if this was already fixed by #12278, but I don't think it is (and it doesn't match any of the test cases there). It's related to #12278, at any rate!
Expected behavior
It should not report an offense, the double splat is not redundant in these examples. And it especially should not autocorrect to invalid syntax.
Actual behavior
After autocorrection:
Steps to reproduce the problem
See above.
RuboCop version
The text was updated successfully, but these errors were encountered: