Class: RuboCop::Cop::Tablecop::AlignAssignments
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Tablecop::AlignAssignments
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/tablecop/align_assignments.rb
Overview
Aligns consecutive assignment statements on the ‘=` operator.
Handles simple assignments (‘=`), compound assignments (`||=`, `&&=`, `+=`, etc.), and constant assignments. Skips lines containing heredocs entirely to avoid infinite loops with Layout/SpaceAroundOperators.
Constant Summary collapse
- MSG =
"Align assignment with other assignments in group"- ASSIGNMENT_TYPES =
Assignment types we handle
%i[lvasgn ivasgn cvasgn gvasgn casgn op_asgn or_asgn and_asgn].freeze
Instance Method Summary collapse
Instance Method Details
#on_new_investigation ⇒ Object
40 41 42 43 44 45 |
# File 'lib/rubocop/cop/tablecop/align_assignments.rb', line 40 def on_new_investigation return if processed_source.blank? groups = find_assignment_groups groups.each { |group| check_group(group) } end |