Class: RuboCop::Cop::Vicenzo::Layout::MultilineMethodCallLineBreaks
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Vicenzo::Layout::MultilineMethodCallLineBreaks
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/vicenzo/layout/multiline_method_call_line_breaks.rb
Overview
Enforces that method calls in a multiline chain are each on their own line.
If a method chain spans more than one line, this cop ensures that every call in the chain is placed on a new line. It prevents "mixed" styles where some methods are on the same line as the receiver while others are broken.
Configuration
This cop allows you to customize the indentation width used during auto-correction. The default width is 2 spaces relative to the previous line.
CustomCops/MultilineMethodCallLineBreaks:
IndentationWidth: 4 # (default is 2)
Constant Summary collapse
- MSG =
'Method calls in a multiline chain must each be on their own line.'- DEFAULT_INDENTATION_WIDTH =
2- LEADING_SPACES_PATTERN =
/\A */- CHAIN_START_PATTERN =
/\A\s*&?\./- OPERATOR_METHODS =
%i[[] []= + - * / % ** << >>].freeze
Instance Method Summary collapse
- #on_send(node) ⇒ Object (also: #on_csend)
Instance Method Details
#on_send(node) ⇒ Object Also known as: on_csend
57 58 59 |
# File 'lib/rubocop/cop/vicenzo/layout/multiline_method_call_line_breaks.rb', line 57 def on_send(node) check_node(node) end |