Sha256: 660ada05eb5a7067481428a6efe79db0f07a2b480b1aba4ac86c64f6c1a6177b

Contents?: true

Size: 858 Bytes

Versions: 51

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  class ConfigObsoletion
    # Base class for ConfigObsoletion rules relating to parameters
    # @api private
    class ParameterRule < Rule
      attr_reader :cop, :parameter, :metadata

      def initialize(config, cop, parameter, metadata)
        super(config)
        @cop = cop
        @parameter = parameter
        @metadata = metadata
      end

      def parameter_rule?
        true
      end

      def violated?
        config[cop]&.key?(parameter)
      end

      def warning?
        severity == 'warning'
      end

      private

      def alternative
        metadata['alternative']
      end

      def alternatives
        metadata['alternatives']
      end

      def reason
        metadata['reason']
      end

      def severity
        metadata['severity']
      end
    end
  end
end

Version data entries

51 entries across 46 versions & 8 rubygems

Version Path
rubocop-1.40.0 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.39.0 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.38.0 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.37.1 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.37.0 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.36.0 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.35.1 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.35.0 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.34.1 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.34.0 lib/rubocop/config_obsoletion/parameter_rule.rb
rubocop-1.33.0 lib/rubocop/config_obsoletion/parameter_rule.rb