Sha256: dce6c49b45f30025d1d082213ec1080802fbb6f9d0ab89a6023f3a0dc42ed829

Contents?: true

Size: 786 Bytes

Versions: 10

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Handles `Max` configuration parameters, especially setting them to an
    # appropriate value with --auto-gen-config.
    # @deprecated Use `exclude_limit <ParameterName>` instead.
    module ConfigurableMax
      private

      def max=(value)
        warn Rainbow(<<~WARNING).yellow, uplevel: 1
          `max=` is deprecated. Use `exclude_limit <ParameterName>` instead.
        WARNING

        cfg = config_to_allow_offenses
        cfg[:exclude_limit] ||= {}
        current_max = cfg[:exclude_limit][max_parameter_name]
        value = [current_max, value].max if current_max
        cfg[:exclude_limit][max_parameter_name] = value
      end

      def max_parameter_name
        'Max'
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubocop-1.70.0 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.69.2 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.69.1 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.69.0 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.68.0 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.67.0 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.66.1 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.66.0 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.65.1 lib/rubocop/cop/mixin/configurable_max.rb
rubocop-1.65.0 lib/rubocop/cop/mixin/configurable_max.rb