lib/goodcheck/config_loader.rb in goodcheck-2.6.1 vs lib/goodcheck/config_loader.rb in goodcheck-2.7.0
- old
+ new
@@ -212,25 +212,23 @@
@import_loader = import_loader
end
def load
Goodcheck.logger.info "Loading configuration: #{path}"
- Goodcheck.logger.tagged "#{path}" do
- Schema.config.coerce(content)
+ Schema.config.coerce(content)
- rules = []
+ rules = []
- load_rules(rules, array(content[:rules]))
+ load_rules(rules, array(content[:rules]))
- Array(content[:import]).each do |import|
- load_import rules, import
- end
+ Array(content[:import]).each do |import|
+ load_import rules, import
+ end
- exclude_paths = Array(content[:exclude])
+ exclude_paths = Array(content[:exclude])
- Config.new(rules: rules, exclude_paths: exclude_paths)
- end
+ Config.new(rules: rules, exclude_paths: exclude_paths)
end
def load_rules(rules, array)
array.each do |hash|
rules << load_rule(hash)
@@ -238,16 +236,14 @@
end
def load_import(rules, import)
Goodcheck.logger.info "Importing rules from #{import}"
- Goodcheck.logger.tagged import do
- import_loader.load(import) do |content|
- json = JSON.parse(JSON.dump(YAML.load(content, filename: import)), symbolize_names: true)
+ import_loader.load(import) do |content|
+ json = JSON.parse(JSON.dump(YAML.load(content, filename: import)), symbolize_names: true)
- Schema.rules.coerce json
- load_rules(rules, json)
- end
+ Schema.rules.coerce json
+ load_rules(rules, json)
end
end
def load_rule(hash)
Goodcheck.logger.debug "Loading rule: #{hash[:id]}"