Sha256: e87cc30e7686b0ce69a15f63745bf68df09dd893abb204319d25f63397f7529f

Contents?: true

Size: 1.03 KB

Versions: 60

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Layout
      # This cop 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 < Cop
        include FirstElementLineBreak

        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

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

Version data entries

60 entries across 41 versions & 5 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.79.0/lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.89.1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.89.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.88.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.87.1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.87.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.86.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/rubocop-0.85.1/lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rbhint-0.85.1.rc1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.85.1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rbhint-0.8.5.rc1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.85.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.84.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.83.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.82.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.81.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.80.1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.80.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/rubocop-0.79.0/lib/rubocop/cop/layout/first_method_parameter_line_break.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.79.0/lib/rubocop/cop/layout/first_method_parameter_line_break.rb