lib/reek/smells/smell_detector.rb in reek-2.2.1 vs lib/reek/smells/smell_detector.rb in reek-3.0.0
- old
+ new
@@ -1,18 +1,20 @@
require 'set'
-require_relative '../core/smell_configuration'
+require_relative 'smell_configuration'
module Reek
module Smells
#
# Shared responsibilities of all smell detectors.
#
# See
- # - docs/Basic-Smell-Options
- # - docs/Code-Smells
- # - docs/Configuration-Files
+ # - {file:docs/Basic-Smell-Options.md}
+ # - {file:docs/Code-Smells.md}
+ # - {file:docs/Configuration-Files.md}
# for details.
+ #
+ # @api private
class SmellDetector
attr_reader :source
# The name of the config field that lists the names of code contexts
# that should not be checked. Add this field to the config for each
@@ -28,11 +30,11 @@
[:def, :defs]
end
def default_config
{
- Core::SmellConfiguration::ENABLED_KEY => true,
+ SmellConfiguration::ENABLED_KEY => true,
EXCLUDE_KEY => DEFAULT_EXCLUDE_SET.dup
}
end
def inherited(subclass)
@@ -69,11 +71,11 @@
attr_reader :smells_found # SMELL: only published for tests
def initialize(source, config = self.class.default_config)
@source = source
- @config = Core::SmellConfiguration.new(config)
+ @config = SmellConfiguration.new(config)
@smells_found = []
end
def register(hooks)
return unless @config.enabled?
@@ -96,10 +98,10 @@
sm = examine_context(context)
@smells_found += sm
end
def enabled_for?(context)
- enabled? && config_for(context)[Core::SmellConfiguration::ENABLED_KEY] != false
+ enabled? && config_for(context)[SmellConfiguration::ENABLED_KEY] != false
end
def exception?(context)
context.matches?(value(EXCLUDE_KEY, context, DEFAULT_EXCLUDE_SET))
end