arturobernalg opened a new pull request, #757:
URL: https://github.com/apache/creadur-rat/pull/757

   ## What
   
   `inputExcludeSize`, and in fact every exclusion mechanism RAT itself offers 
(patterns, standard collections, etc.), has no effect on a file that reaches 
RAT through an Ant `ResourceCollection` rather than RAT's own directory walk. 
That includes the common case of a `<fileset>` nested inside `<rat:report>`, a 
`<file>` element, and an externally-resolved `ResourceCollection` such as a 
Gradle `fileTree` handed to the Ant task via 
`FileCollection.AntType.ResourceCollection` (the way Apache Solr's build wires 
RAT).
   
   ## Why
   
   `DirectoryWalker` applies the configured `DocumentNameMatcher` to every 
child it finds while walking a directory (see `FileDocument#listChildren()`), 
wrapping an excluded child as an `IgnoredDocument`. That is the only place in 
the codebase that ever calls the matcher.
   
   `ResourceCollectionContainer` (used by the Ant `<rat:report>` task for every 
resource it receives, exclusively) never walks a directory: Ant, or whatever 
tool resolved the `ResourceCollection`, has already produced the final file 
list. `ResourceCollectionContainer#run()` built a `DocumentNameMatcher` for 
each file but never called it, so nothing ever excluded anything reached this 
way — the option is parsed and registered correctly (confirmed by the existing 
`ReportOptionTest` coverage), it is just never consulted.
   
   ## How
   
   Each resource is now checked against its excluder before being reported, 
mirroring `DirectoryWalker`'s own `FileFilter` logic: an excluded resource is 
wrapped as an `IgnoredDocument` instead of a `FileDocument`, the same 
representation already used for an excluded child during a directory walk.
   
   ## Tests
   
   - `ReportTest#testTinyUnlicensedFileControl`: a baseline control confirming 
a small, unlicensed file added via `<file>` is reachable and normally reported 
as unapproved.
   - `ReportTest#testInputExcludeSizeExcludesSmallFile`: the same file, with 
`inputExcludeSize` set above its size, now correctly excluded. This test fails 
on unfixed code with the exact reported symptom (the file is still flagged 
unapproved) and passes with the fix.
   - Full `apache-rat-tasks` suite: 115 tests, 0 failures. Checkstyle and 
spotbugs clean.
   
   https://claude.ai/code/session_01ReVkpYAznRPFBkHQFwYWcK


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to