diff --git a/lib/reek/configuration/app_configuration.rb b/lib/reek/configuration/app_configuration.rb index 05612aa00..2d50f6290 100644 --- a/lib/reek/configuration/app_configuration.rb +++ b/lib/reek/configuration/app_configuration.rb @@ -67,7 +67,10 @@ def directive_for(source_via) end def path_excluded?(path) - excluded_paths.map(&:expand_path).include?(path.expand_path) + expanded_path = path.expand_path + excluded_paths.map(&:expand_path).any? do |excluded_path| + expanded_path == excluded_path || expanded_path.to_s.start_with?("#{excluded_path}/") + end end def load_values(values) diff --git a/lib/reek/configuration/excluded_paths.rb b/lib/reek/configuration/excluded_paths.rb index 3737892ac..79f9ef3f2 100644 --- a/lib/reek/configuration/excluded_paths.rb +++ b/lib/reek/configuration/excluded_paths.rb @@ -14,8 +14,10 @@ module ExcludedPaths # @param paths [String] # @return [undefined] def add(paths) - paths.flat_map { |path| Dir[path] }. - each { |path| self << Pathname(path) } + paths.flat_map do |path| + expanded = Dir[path] + expanded.empty? ? [path] : expanded + end.each { |path| self << Pathname(path) } end end end