Module: RuboCop::Cop::MultilineExpressionIndentation

Included in:
Layout::MultilineMethodCallIndentation, Layout::MultilineOperationIndentation
Defined in:
lib/rubocop/cop/mixin/multiline_expression_indentation.rb

Overview

Common functionality for checking multiline method calls and binary operations.

Constant Summary collapse

KEYWORD_ANCESTOR_TYPES =

rubocop:disable Metrics/ModuleLength

%i[for if while until return].freeze
UNALIGNED_RHS_TYPES =
%i[if while until for return array kwbegin].freeze
DEFAULT_MESSAGE_TAIL =
'an expression'
ASSIGNMENT_MESSAGE_TAIL =
'an expression in an assignment'
KEYWORD_MESSAGE_TAIL =
'a %<kind>s in %<article>s `%<keyword>s` statement'

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object Also known as: on_csend



14
15
16
17
18
19
20
21
22
# File 'lib/rubocop/cop/mixin/multiline_expression_indentation.rb', line 14

def on_send(node)
  return if !node.receiver || node.method?(:[])
  return unless relevant_node?(node)

  lhs = left_hand_side(node.receiver)
  rhs = right_hand_side(node)
  range = offending_range(node, lhs, rhs, style)
  check(range, node, lhs, rhs)
end