class RuboCop::Cop::Layout::AssignmentIndentation
other cops such as ‘IndentationConsistency` and `EndAlignment`.
The indentation of the remaining lines can be corrected with
end
’bar’
if foo
value =
# good
end
’bar’
if foo
value =
# bad
@example
right-hand-side of a multi-line assignment.
Checks the indentation of the first line of the
def autocorrect(corrector, node)
def autocorrect(corrector, node) AlignmentCorrector.correct(corrector, processed_source, node, column_delta) end
def check_assignment(node, rhs)
def check_assignment(node, rhs) return unless rhs return unless node.loc.operator return if same_line?(node.loc.operator, rhs) base = display_column(leftmost_multiple_assignment(node).source_range) check_alignment([rhs], base + configured_indentation_width) end
def leftmost_multiple_assignment(node)
def leftmost_multiple_assignment(node) return node unless same_line?(node, node.parent) && node.parent.assignment? leftmost_multiple_assignment(node.parent) node.parent end