Shared responsibilities of all smell detectors.
The default value for the EXCLUDE_KEY if it isn’t specified in any configuration file.
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 smell that should ignore this code element.
# File lib/reek/smells/smell_detector.rb, line 32 def contexts [:defn, :defs] end
# File lib/reek/smells/smell_detector.rb, line 89 def config_for(ctx) ctx.config[self.class.name.split(/::/)[-1]] || {} # BUG: needs to consider smell class AND subclass end
# File lib/reek/smells/smell_detector.rb, line 62 def configure_with(config) @config.adopt!(config) end
SMELL: Getter (only used in 1 test)
# File lib/reek/smells/smell_detector.rb, line 58 def enabled? @config.enabled? end
# File lib/reek/smells/smell_detector.rb, line 66 def examine(context) enabled = @config.enabled? && config_for(context)[Core::SmellConfiguration::ENABLED_KEY] != false if enabled && !exception?(context) sm = examine_context(context) @smells_found += sm end end
# File lib/reek/smells/smell_detector.rb, line 74 def examine_context(context) end
# File lib/reek/smells/smell_detector.rb, line 77 def exception?(context) context.matches?(value(EXCLUDE_KEY, context, DEFAULT_EXCLUDE_SET)) end
# File lib/reek/smells/smell_detector.rb, line 52 def register(hooks) return unless @config.enabled? self.class.contexts.each { |ctx| hooks[ctx] << self } end
Generated with the Darkfish Rdoc Generator 2.