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'.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



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

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