Sha256: 62d05b92f0dc6ce57ec7a6c59f552ca9195b0d65ea6e62ce0bb44a3840328a01

Contents?: true

Size: 1006 Bytes

Versions: 19

Compression:

Stored size: 1006 Bytes

Contents

# frozen_string_literal: true
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

19 entries across 19 versions & 1 rubygems

Version Path
reek-4.4.2 lib/reek/configuration/configuration_validator.rb
reek-4.4.1 lib/reek/configuration/configuration_validator.rb
reek-4.4.0 lib/reek/configuration/configuration_validator.rb
reek-4.3.0 lib/reek/configuration/configuration_validator.rb
reek-4.2.5 lib/reek/configuration/configuration_validator.rb
reek-4.2.4 lib/reek/configuration/configuration_validator.rb
reek-4.2.3 lib/reek/configuration/configuration_validator.rb
reek-4.2.2 lib/reek/configuration/configuration_validator.rb
reek-4.2.1 lib/reek/configuration/configuration_validator.rb
reek-4.2.0 lib/reek/configuration/configuration_validator.rb
reek-4.1.1 lib/reek/configuration/configuration_validator.rb
reek-4.1.0 lib/reek/configuration/configuration_validator.rb
reek-4.0.5 lib/reek/configuration/configuration_validator.rb
reek-4.0.4 lib/reek/configuration/configuration_validator.rb
reek-4.0.3 lib/reek/configuration/configuration_validator.rb
reek-4.0.2 lib/reek/configuration/configuration_validator.rb
reek-4.0.1 lib/reek/configuration/configuration_validator.rb
reek-4.0.0 lib/reek/configuration/configuration_validator.rb
reek-4.0.0.pre1 lib/reek/configuration/configuration_validator.rb