Sha256: 41f69f07e55db79d78026785c1b05fa12d54e6afb358a894155ef6cccc878019

Contents?: true

Size: 966 Bytes

Versions: 26

Compression:

Stored size: 966 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Layout
      # Checks for a line break before the first parameter in a
      # multi-line method parameter definition.
      #
      # @example
      #
      #     # bad
      #     def method(foo, bar,
      #         baz)
      #       do_something
      #     end
      #
      #     # good
      #     def method(
      #         foo, bar,
      #         baz)
      #       do_something
      #     end
      #
      #     # ignored
      #     def method foo,
      #         bar
      #       do_something
      #     end
      class FirstMethodParameterLineBreak < Base
        include FirstElementLineBreak
        extend AutoCorrector

        MSG = 'Add a line break before the first parameter of a multi-line method parameter list.'

        def on_def(node)
          check_method_line_break(node, node.arguments)
        end
        alias on_defs on_def
      end
    end
  end
end

Version data entries

26 entries across 22 versions & 3 rubygems

Version Path
rubocop-1.32.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-1.31.2 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-1.31.1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-1.31.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-1.30.1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-1.30.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb