Sha256: c6307b3dc8c2d65ff29e8d3538550bd63af0b085003dacc0aa7af1e65cf1fb54
Contents?: true
Size: 1.17 KB
Versions: 24
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module Layout # This cop checks the indentation of the first line of the # right-hand-side of a multi-line assignment. # # @example # # bad # value = # if foo # 'bar' # end # # # good # value = # if foo # 'bar' # end # # The indentation of the remaining lines can be corrected with # other cops such as `IndentationConsistency` and `EndAlignment`. class IndentAssignment < Cop include CheckAssignment include Alignment MSG = 'Indent the first line of the right-hand-side of a ' \ 'multi-line assignment.' def check_assignment(node, rhs) return unless rhs return unless node.loc.operator return if node.loc.operator.line == rhs.first_line base = display_column(node.source_range) check_alignment([rhs], base + configured_indentation_width) end def autocorrect(node) AlignmentCorrector.correct(processed_source, node, column_delta) end end end end end
Version data entries
24 entries across 16 versions & 2 rubygems