diff --git a/lib/reek/configuration/configuration_converter.rb b/lib/reek/configuration/configuration_converter.rb index 5b7248a8a..8f1d81979 100644 --- a/lib/reek/configuration/configuration_converter.rb +++ b/lib/reek/configuration/configuration_converter.rb @@ -80,6 +80,8 @@ def strings_to_regexes_for_detectors to_regex item end end + rescue NoMethodError + warn_about_missing_configuration(detector) if detectors[detector].nil? end end end @@ -101,10 +103,25 @@ def strings_to_regexes_for_directories to_regex item end end + rescue NoMethodError + warn_about_missing_configuration(detector) if configuration.nil? end end end end + + def warn_about_missing_configuration(detector) + msg = <<~ERROR + ############################### + + Please review the configuration file (e.g. .reek.yml in your project directory). + It looks like the configuration for #{detector} is missing. + You can find the configuration options documentation over here: https://github.com/troessner/reek#configuration-options. + + ############################### + ERROR + warn msg + end end end end diff --git a/lib/reek/configuration/default_directive.rb b/lib/reek/configuration/default_directive.rb index 37b3aa207..db989d161 100644 --- a/lib/reek/configuration/default_directive.rb +++ b/lib/reek/configuration/default_directive.rb @@ -21,8 +21,10 @@ module DefaultDirective # @return [self] def add(detectors_configuration) detectors_configuration.each do |name, configuration| - detector = key_to_smell_detector(name) - self[detector] = (self[detector] || {}).merge configuration + if configuration + detector = key_to_smell_detector(name) + self[detector] = (self[detector] || {}).merge configuration + end end self end