Class: RuboCop::Cop::Yoshiki::Layout::EmptyLineAroundMultilineAssignment
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Yoshiki::Layout::EmptyLineAroundMultilineAssignment
- Extended by:
- AutoCorrector
- Includes:
- CheckAssignment, EmptyLineAroundMultilineStatement
- Defined in:
- lib/rubocop/cop/yoshiki/layout/empty_line_around_multiline_assignment.rb
Overview
Isolates a multiline assignment from neighboring statements with a
blank line. "Multiline" here means the RHS is a body (block, heredoc,
if / case / begin, …), not a hanging call or array/hash wrap.
Setter sends (spec.description =) count. A do/end that is the
whole statement (not assigned) is Yoshiki/Layout/EmptyLineAroundMultilineBlock.
A sibling if/case is Yoshiki/Layout/EmptyLineAroundMultilineConditional.
Layout/ExtraSpacing (ForceEqualSignAlignment) pads = in a group;
a blank line splits that group.
Constant Summary collapse
- MSG_BEFORE =
'Add a blank line before this multiline assignment.'.freeze
- MSG_AFTER =
'Add a blank line after this multiline assignment.'.freeze
Constants included from EmptyLineAroundMultilineStatement::Paragraph
EmptyLineAroundMultilineStatement::Paragraph::BLOCK_TYPES, EmptyLineAroundMultilineStatement::Paragraph::BODY_TYPES, EmptyLineAroundMultilineStatement::Paragraph::CONDITIONAL_TYPES
Instance Method Summary collapse
Instance Method Details
#check_assignment(node, rhs) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/rubocop/cop/yoshiki/layout/empty_line_around_multiline_assignment.rb', line 55 def check_assignment node, rhs return unless rhs return if node.call_type? && !assignment_call?(node) return unless bodyish?(rhs) check_empty_lines_around(node) end |