Sha256: a4cc332a7faea61e02922273db2993d9f3819593f5cfddf73fbd8cd9febf3956

Contents?: true

Size: 821 Bytes

Versions: 31

Compression:

Stored size: 821 Bytes

Contents

# frozen_string_literal: true

require_relative '../errors/config_file_error'

module Reek
  module Configuration
    #
    # Configuration validator module.
    #
    module ConfigurationValidator
      private

      # @quality :reek:UtilityFunction
      def smell_type?(key)
        Reek::SmellDetectors.const_defined? key
      rescue NameError
        false
      end

      # @quality :reek:UtilityFunction
      def key_to_smell_detector(key)
        Reek::SmellDetectors.const_get key
      end

      def with_valid_directory(path)
        directory = Pathname.new path.to_s.chomp('/')
        if directory.file?
          raise Errors::ConfigFileError,
                "`#{directory}` is supposed to be a directory but is a file"
        end
        yield directory if block_given?
      end
    end
  end
end

Version data entries

31 entries across 29 versions & 2 rubygems

Version Path
reek-6.4.0 lib/reek/configuration/configuration_validator.rb
reek-6.3.0 lib/reek/configuration/configuration_validator.rb
reek-6.2.0 lib/reek/configuration/configuration_validator.rb
reek-6.1.4 lib/reek/configuration/configuration_validator.rb
reek-6.1.3 lib/reek/configuration/configuration_validator.rb
reek-6.1.2 lib/reek/configuration/configuration_validator.rb
reek-6.1.1 lib/reek/configuration/configuration_validator.rb
reek-6.1.0 lib/reek/configuration/configuration_validator.rb
reek-6.0.6 lib/reek/configuration/configuration_validator.rb
reek-6.0.5 lib/reek/configuration/configuration_validator.rb
reek-6.0.4 lib/reek/configuration/configuration_validator.rb
reek-6.0.3 lib/reek/configuration/configuration_validator.rb
reek-6.0.2 lib/reek/configuration/configuration_validator.rb
reek-6.0.1 lib/reek/configuration/configuration_validator.rb
reek-6.0.0 lib/reek/configuration/configuration_validator.rb
reek-5.6.0 lib/reek/configuration/configuration_validator.rb
reek-5.5.0 lib/reek/configuration/configuration_validator.rb
reek-5.4.1 lib/reek/configuration/configuration_validator.rb
reek-5.4.0 lib/reek/configuration/configuration_validator.rb
reek-5.3.2 lib/reek/configuration/configuration_validator.rb