Sha256: 645193f87c5523834ad471f3d65b8558472156b512045aa145bd414b273dbf87

Contents?: true

Size: 1.68 KB

Versions: 11

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Naming
      # This cop checks method parameter names for how descriptive they
      # are. It is highly configurable.
      #
      # The `MinNameLength` config option takes an integer. It represents
      # the minimum amount of characters the name must be. Its default is 3.
      # The `AllowNamesEndingInNumbers` config option takes a boolean. When
      # set to false, this cop will register offenses for names ending with
      # numbers. Its default is false. The `AllowedNames` config option
      # takes an array of whitelisted names that will never register an
      # offense. The `ForbiddenNames` config option takes an array of
      # blacklisted names that will always register an offense.
      #
      # @example
      #   # bad
      #   def bar(varOne, varTwo)
      #     varOne + varTwo
      #   end
      #
      #   # With `AllowNamesEndingInNumbers` set to false
      #   def foo(num1, num2)
      #     num1 * num2
      #   end
      #
      #   # With `MinArgNameLength` set to number greater than 1
      #   def baz(a, b, c)
      #     do_stuff(a, b, c)
      #   end
      #
      #   # good
      #   def bar(thud, fred)
      #     thud + fred
      #   end
      #
      #   def foo(speed, distance)
      #     speed * distance
      #   end
      #
      #   def baz(age_a, height_b, gender_c)
      #     do_stuff(age_a, height_b, gender_c)
      #   end
      class UncommunicativeMethodParamName < Cop
        include UncommunicativeName

        def on_def(node)
          return unless node.arguments?
          check(node, node.arguments)
        end
        alias on_defs on_def
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
rubocop-0.58.2 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.58.1 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.58.0 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rubocop-0.57.2/lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.57.2 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.57.1 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.57.0 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.56.0 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.55.0 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.54.0 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb
rubocop-0.53.0 lib/rubocop/cop/naming/uncommunicative_method_param_name.rb