Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/reek/configuration/app_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions lib/reek/configuration/excluded_paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading