Class: Reek::SmellConfig
Constant Summary collapse
- SMELL_CLASSES =
[ Smells::ControlCouple, Smells::Duplication, Smells::FeatureEnvy, Smells::LargeClass, Smells::LongMethod, Smells::LongParameterList, Smells::LongYieldList, Smells::NestedIterators, Smells::UncommunicativeName, Smells::UtilityFunction, ]
Instance Method Summary collapse
- #all_reekfiles(path) ⇒ Object
-
#initialize ⇒ SmellConfig
constructor
A new instance of SmellConfig.
- #load_local(file) ⇒ Object
- #smell_listeners ⇒ Object
Constructor Details
#initialize ⇒ SmellConfig
Returns a new instance of SmellConfig.
55 56 57 58 |
# File 'lib/reek/smells/smells.rb', line 55 def initialize defaults_file = File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'defaults.reek') @config = YAML.load_file(defaults_file) end |
Instance Method Details
#all_reekfiles(path) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/reek/smells/smells.rb', line 74 def all_reekfiles(path) return [] unless File.exist?(path) parent = File.dirname(path) return [] if path == parent all_reekfiles(parent) + Dir["#{path}/*.reek"] end |
#load_local(file) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/reek/smells/smells.rb', line 66 def load_local(file) path = File.(file) all_reekfiles(path).each do |rfile| YAML.load_file(rfile).push_keys(@config) end self end |
#smell_listeners ⇒ Object
60 61 62 63 64 |
# File 'lib/reek/smells/smells.rb', line 60 def smell_listeners() result = Hash.new {|hash,key| hash[key] = [] } SMELL_CLASSES.each { |smell| smell.listen(result, @config) } return result end |