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

[Fix #10456] Fix a false positive for Layout/MultilineMethodCallIndentation #10458

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1 @@
* [#10456](https://github.com/rubocop/rubocop/issues/10456): Fix a false positive for `Layout/MultilineMethodCallIndentation` when using `EnforcedStyle: indented` with indented assignment method. ([@koic][])
4 changes: 3 additions & 1 deletion lib/rubocop/cop/mixin/multiline_expression_indentation.rb
Expand Up @@ -29,7 +29,9 @@ def on_send(node)
# b c { block }. <-- b is indented relative to a
# d <-- d is indented relative to a
def left_hand_side(lhs)
lhs = lhs.parent while lhs.parent&.send_type? && lhs.parent.loc.dot
while lhs.parent&.send_type? && lhs.parent.loc.dot && !lhs.parent.assignment_method?
lhs = lhs.parent
end
lhs
end

Expand Down
Expand Up @@ -985,6 +985,15 @@ def foo
.to_s
RUBY
end

it "accepts indentation of assignment to obj.#{lhs} with newline after =" do
expect_no_offenses(<<~RUBY)
obj.#{lhs} =
int_part
.abs
.to_s
RUBY
end
end

include_examples 'assignment', 'a'
Expand Down