lib/reek/smells/smell_detector.rb in reek-1.5.1 vs lib/reek/smells/smell_detector.rb in reek-1.6.0

- old
+ new

@@ -12,10 +12,12 @@ # # Shared responsibilities of all smell detectors. # class SmellDetector + attr_reader :source, :smell_category, :smell_type + # 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. EXCLUDE_KEY = 'exclude' @@ -32,11 +34,29 @@ { Core::SmellConfiguration::ENABLED_KEY => true, EXCLUDE_KEY => DEFAULT_EXCLUDE_SET.dup } end + end - def smell_class_name + def smell_category + self.class.smell_category + end + + def smell_type + self.class.smell_type + end + + class << self + def smell_category + @smell_category ||= default_smell_category + end + + def smell_type + @smell_type ||= default_smell_category + end + + def default_smell_category name.split(/::/)[-1] end end attr_reader :smells_found # SMELL: only published for tests