Sha256: 237c5b69b685aa474241c4754dbe0ca165b3ba7c7e7901c90ab1e4cabe8cb677

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Layout
      # This hint ensures that each item in a multi-line array
      # starts on a separate line.
      #
      # @example
      #
      #   # bad
      #   [
      #     a, b,
      #     c
      #   ]
      #
      #   # good
      #   [
      #     a,
      #     b,
      #     c
      #   ]
      class MultilineArrayLineBreaks < Cop
        include MultilineElementLineBreaks

        MSG = 'Each item in a multi-line array must start ' \
          'on a separate line.'

        def on_array(node)
          check_line_breaks(node, node.children)
        end

        def autocorrect(node)
          EmptyLineCorrector.insert_before(node)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rbhint-0.87.1.rc1 lib/rubocop/cop/layout/multiline_array_line_breaks.rb
rbhint-0.85.1.rc2 lib/rubocop/cop/layout/multiline_array_line_breaks.rb