Claudenw commented on code in PR #433: URL: https://github.com/apache/creadur-rat/pull/433#discussion_r2101780493
########## apache-rat-core/src/main/java/org/apache/rat/config/exclusion/fileProcessors/GitIgnoreBuilder.java: ########## @@ -53,6 +58,43 @@ public GitIgnoreBuilder() { super(IGNORE_FILE, COMMENT_PREFIX, true); } + private MatcherSet processGlobalIgnore(final Consumer<MatcherSet> matcherSetConsumer, final DocumentName root, final DocumentName globalGitIgnore) { + final MatcherSet.Builder matcherSetBuilder = new MatcherSet.Builder(); + final List<String> iterable = new ArrayList<>(); + ExclusionUtils.asIterator(globalGitIgnore.asFile(), commentFilter) + .map(entry -> modifyEntry(matcherSetConsumer, globalGitIgnore, entry).orElse(null)) + .filter(Objects::nonNull) + .map(entry -> ExclusionUtils.qualifyPattern(root, entry)) + .forEachRemaining(iterable::add); + + Set<String> included = new HashSet<>(); + Set<String> excluded = new HashSet<>(); + MatcherSet.Builder.segregateList(excluded, included, iterable); + DocumentName displayName = DocumentName.builder(root).setName("global gitignore").build(); + matcherSetBuilder.addExcluded(displayName, excluded); + matcherSetBuilder.addIncluded(displayName, included); + return matcherSetBuilder.build(); + } + + @Override + protected MatcherSet process(final Consumer<MatcherSet> matcherSetConsumer, final DocumentName root, final DocumentName documentName) { + if (root.equals(documentName.getBaseDocumentName())) { + Optional<File> globalGitIgnore = globalGitIgnore(); + List<MatcherSet> matcherSets = new ArrayList<MatcherSet>(); + matcherSets.add(super.process(matcherSetConsumer, root, documentName)); + if (globalGitIgnore.isPresent()) { + LevelBuilder levelBuilder = getLevelBuilder(-1); Review Comment: No bother, just providing some feedback while I had the time to look. I understand that you are not ready for a review. So just consider my comments in draft as just that, comments and/or suggestions. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@creadur.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org