Sha256: b3acb87aac51e739f5b33f0406af5e13d7963945ac4d1cf155c913eaa8eae193

Contents?: true

Size: 999 Bytes

Versions: 2

Compression:

Stored size: 999 Bytes

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 OnMethodDef
        include FirstElementLineBreak

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

        def on_method_def(node, _method_name, args, _body)
          check_method_line_break(node, args.to_a)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.49.1 lib/rubocop/cop/layout/first_method_parameter_line_break.rb
rubocop-0.49.0 lib/rubocop/cop/layout/first_method_parameter_line_break.rb