Skip to content

Commit

Permalink
[Fix rubocop#8444] Fix an error for `Layout/FirstMethodArgumentLineBreak
Browse files Browse the repository at this point in the history
Fixes rubocop#8444.

This PR fixes an error for `Layout/FirstMethodArgumentLineBreak`
when using kwargs in `super`
  • Loading branch information
koic committed Aug 3, 2020
1 parent 7514b7a commit 87a4e37
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/layout/first_method_argument_line_break.rb
Expand Up @@ -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:
#
Expand Down
Expand Up @@ -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,
Expand Down

0 comments on commit 87a4e37

Please sign in to comment.