Skip to content

Commit

Permalink
Merge pull request #11484 from fatkodima/fix-closing_parenthesis_inde…
Browse files Browse the repository at this point in the history
…ntation

Fix `Layout/ClosingParenthesisIndentation` for keyword splat arguments
  • Loading branch information
koic committed Jan 23, 2023
2 parents 51ded37 + 809ca3a commit 99c8b17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#11483](https://github.com/rubocop/rubocop/issues/11483): Fix `Layout/ClosingParenthesisIndentation` for keyword splat arguments. ([@fatkodima][])
2 changes: 1 addition & 1 deletion lib/rubocop/cop/layout/closing_parenthesis_indentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def expected_column(left_paren, elements)
def all_elements_aligned?(elements)
elements.flat_map do |e|
if e.hash_type?
e.each_pair.map { |pair| pair.loc.column }
e.each_child_node.map { |child| child.loc.column }
else
e.loc.column
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
RUBY
end

it 'does not register an offense when using keyword splat arguments' do
expect_no_offenses(<<~RUBY)
some_method(x,
**options
)
RUBY
end

it 'accepts a correctly indented )' do
expect_no_offenses(<<~RUBY)
some_method(a,
Expand Down

0 comments on commit 99c8b17

Please sign in to comment.