class Reek::Configuration::AppConfiguration
@public
Reek’s application configuration.
def self.default
def self.default new(values: {}) end
def self.from_default_path
-
(AppConfiguration)
-
def self.from_default_path values = ConfigurationFileFinder.find_and_load(path: nil) new(values: values) end
def self.from_hash(hash)
-
(AppConfiguration)
-
Parameters:
-
hash
(Hash
) -- The configuration hash to load.
def self.from_hash(hash) new(values: hash) end
def self.from_path(path)
-
(AppConfiguration)
-
Parameters:
-
path
(Pathname
) -- the path to the config file.
def self.from_path(path) values = ConfigurationFileFinder.find_and_load(path: path) new(values: values) end
def default_directive
def default_directive @default_directive ||= {}.extend(DefaultDirective) end
def directive_for(source_via)
-
(Hash)
- the directory directive for the source with the default directive
Parameters:
-
source_via
(String
) -- the source of the code inspected
def directive_for(source_via) hit = directory_directives.directive_for(source_via) hit ? default_directive.merge(hit) : default_directive end
def directory_directives
def directory_directives @directory_directives ||= {}.extend(DirectoryDirectives) end
def excluded_paths
def excluded_paths @excluded_paths ||= [].extend(ExcludedPaths) end
def initialize(values: {})
def initialize(values: {}) load_values(values) end
def load_values(values)
def load_values(values) values.each do |key, value| case key when EXCLUDE_PATHS_KEY excluded_paths.add value when DIRECTORIES_KEY directory_directives.add value when DETECTORS_KEY default_directive.add value end end end
def path_excluded?(path)
def path_excluded?(path) excluded_paths.map(&:expand_path).include?(path.expand_path) end