Sha256: 918d19fa31727a1efc10223483a6579d84787634bd147ce56eff37ac104909d2

Contents?: true

Size: 571 Bytes

Versions: 3

Compression:

Stored size: 571 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common code for empty parameter cops.
    module EmptyParameter
      extend NodePattern::Macros

      private

      # @!method empty_arguments?(node)
      def_node_matcher :empty_arguments?, <<~PATTERN
        (block _ $(args) _)
      PATTERN

      def check(node)
        empty_arguments?(node) do |args|
          return if args.empty_and_without_delimiters?

          add_offense(args) do |corrector|
            autocorrect(corrector, args)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-1.12.1 lib/rubocop/cop/mixin/empty_parameter.rb
rubocop-1.12.0 lib/rubocop/cop/mixin/empty_parameter.rb
rubocop-1.11.0 lib/rubocop/cop/mixin/empty_parameter.rb