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

[:for, :return, *Util::MODIFIER_NODES].freeze
UNALIGNED_RHS_TYPES =
%i[if while until for return
array kwbegin].freeze
ASSIGNMENT_RHS_TYPES =
[:send, *Util::ASGN_NODES].freeze
DEFAULT_MESSAGE_TAIL =
'an expression'.freeze
ASSIGNMENT_MESSAGE_TAIL =
'an expression in an assignment'.freeze
KEYWORD_MESSAGE_TAIL =
'a %<kind>s in %<article>s `%<keyword>s` ' \
'statement'.freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/rubocop/cop/mixin/multiline_expression_indentation.rb', line 17

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