Sha256: 2c9287815d9b41897684b290dc8f16363791960af81331727a374c466b8a8955

Contents?: true

Size: 976 Bytes

Versions: 9

Compression:

Stored size: 976 Bytes

Contents

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

      # :reek:UtilityFunction
      def smell_type?(key)
        case key
        when Class
          true
        when String
          begin
            Reek::Smells.const_defined? key
          rescue NameError
            false
          end
        end
      end

      # :reek:UtilityFunction
      def key_to_smell_detector(key)
        case key
        when Class
          key
        else
          Reek::Smells.const_get key
        end
      end

      def error_message_for_file_given(pathname)
        "Configuration error: `#{pathname}` is supposed to be a directory but is a file"
      end

      def with_valid_directory(path)
        directory = Pathname.new path.to_s.chomp('/')
        abort(error_message_for_file_given(directory)) if directory.file?
        yield directory if block_given?
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
reek-3.11 lib/reek/configuration/configuration_validator.rb
reek-3.10.2 lib/reek/configuration/configuration_validator.rb
reek-3.10.1 lib/reek/configuration/configuration_validator.rb
reek-3.10.0 lib/reek/configuration/configuration_validator.rb
reek-3.9.1 lib/reek/configuration/configuration_validator.rb
reek-3.9.0 lib/reek/configuration/configuration_validator.rb
reek-3.8.3 lib/reek/configuration/configuration_validator.rb
reek-3.8.2 lib/reek/configuration/configuration_validator.rb
reek-3.8.1 lib/reek/configuration/configuration_validator.rb