Sha256: f8986b5d46aadcc0f3b54ebd27d4d1b8bd7c9060b7dbb57700381d95fc667257

Contents?: true

Size: 1.57 KB

Versions: 181

Compression:

Stored size: 1.57 KB

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Naming
      # Checks block 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 1.
      # 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 permitted names that will never register an
      # offense. The `ForbiddenNames` config option takes an array of
      # restricted names that will always register an offense.
      #
      # @example
      #   # bad
      #   bar do |varOne, varTwo|
      #     varOne + varTwo
      #   end
      #
      #   # With `AllowNamesEndingInNumbers` set to false
      #   foo { |num1, num2| num1 * num2 }
      #
      #   # With `MinNameLength` set to number greater than 1
      #   baz { |a, b, c| do_stuff(a, b, c) }
      #
      #   # good
      #   bar do |thud, fred|
      #     thud + fred
      #   end
      #
      #   foo { |speed, distance| speed * distance }
      #
      #   baz { |age, height, gender| do_stuff(age, height, gender) }
      class BlockParameterName < Base
        include UncommunicativeName

        def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
          return unless node.arguments?

          check(node, node.arguments)
        end
      end
    end
  end
end

Version data entries

181 entries across 176 versions & 18 rubygems

Version Path
rubocop-1.63.2 lib/rubocop/cop/naming/block_parameter_name.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.63.1 lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.63.0 lib/rubocop/cop/naming/block_parameter_name.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.62.1/lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.62.1 lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.62.0 lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.61.0 lib/rubocop/cop/naming/block_parameter_name.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.2/lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.60.2 lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.4 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.60.1 lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
study_line-0.2.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/naming/block_parameter_name.rb
rubocop-1.60.0 lib/rubocop/cop/naming/block_parameter_name.rb