diff --git a/CHANGELOG.md b/CHANGELOG.md index 736d05fffee..425e5d131c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ * [#8283](https://github.com/rubocop-hq/rubocop/issues/8283): Fix line length calculation for `Style/IfUnlessModifier` to correctly take into account a comment on the first line when considering conversation to a single-line form. ([@dsavochkin][]) * [#8226](https://github.com/rubocop-hq/rubocop/issues/8226): Fix `Style/IfUnlessModifier` to add parentheses when converting if-end condition inside an array or a hash to a single-line form. ([@dsavochkin][]) * [#8443](https://github.com/rubocop-hq/rubocop/pull/8443): Fix an incorrect auto-correct for `Style/StructInheritance` when there is a comment before class declaration. ([@koic][]) +* [#8444](https://github.com/rubocop-hq/rubocop/issues/8444): Fix an error for `Layout/FirstMethodArgumentLineBreak` when using kwargs in `super`. ([@koic][]) ### Changes diff --git a/lib/rubocop/cop/layout/first_method_argument_line_break.rb b/lib/rubocop/cop/layout/first_method_argument_line_break.rb index c6b83b92680..25d6661cf43 100644 --- a/lib/rubocop/cop/layout/first_method_argument_line_break.rb +++ b/lib/rubocop/cop/layout/first_method_argument_line_break.rb @@ -27,7 +27,7 @@ class FirstMethodArgumentLineBreak < Cop 'multi-line method argument list.' def on_send(node) - args = node.arguments + args = node.arguments.dup # If there is a trailing hash arg without explicit braces, like this: # diff --git a/spec/rubocop/cop/layout/first_method_argument_line_break_spec.rb b/spec/rubocop/cop/layout/first_method_argument_line_break_spec.rb index d26ce9e8cc8..0adc2cec5fa 100644 --- a/spec/rubocop/cop/layout/first_method_argument_line_break_spec.rb +++ b/spec/rubocop/cop/layout/first_method_argument_line_break_spec.rb @@ -80,6 +80,10 @@ expect_no_offenses('foo(bar, baz, bing)') end + it 'ignores kwargs listed on a single line when the arguments are used in `super`' do + expect_no_offenses('super(foo: 1, bar: 2)') + end + it 'ignores arguments without parens' do expect_no_offenses(<<~RUBY) foo bar,