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

   ## What
   
   `excludeSubProjects` on the Maven plugin becomes ineffective as soon as the 
deprecated `excludes` configuration is also used: sub-project directories are 
no longer excluded from the parent's own rat scan.
   
   ## Why
   
   Internally, `excludeSubProjects` adds its generated patterns (`<module>/**`) 
through the non-deprecated `input-exclude` option. 
`ArgumentTracker#validateSet` (and the identical, hand-duplicated logic 
generated from `Args.tpl` for `BaseRatMojo`/the Ant task) treats 
`input-exclude` and the deprecated `exclude` as mutually exclusive aliases of 
the same commons-cli option group: once `exclude` has a value, any later write 
to `input-exclude` is silently rejected, with no warning, because the check 
runs before any logging.
   
   That exclusivity rule makes sense for a single-valued option (one of two 
spellings of a flag), but is wrong for a multi-valued option such as 
`exclude`/`input-exclude`: both spellings should accumulate into a single 
merged list, not compete for one slot.
   
   ## How
   
   `validateSet` now returns immediately for any option where 
`Option#hasArgs()` is true, before the deprecated/exclusivity checks. A new 
`storageKey` helper stores values from every alias of such a multi-valued 
option under the key of its non-deprecated option, so the deprecated and 
non-deprecated spellings merge into one entry instead of one discarding the 
other. This keeps the final argument list built by `args()` naming each option 
only once, as commons-cli requires for options of the same group.
   
   The fix is applied in both `apache-rat-core`'s hand-maintained 
`ArgumentTracker` and in `apache-rat-tools/src/main/resources/Args.tpl`, the 
shared template that generates both the Maven plugin's `BaseRatMojo` and the 
Ant task's equivalent class, so all three front ends get the same behavior.
   
   ## Tests
   
   - Added 
`ArgumentTrackerTest#addArgOnDeprecatedAliasAccumulatesWithNonDeprecatedAlias`, 
which fails on unfixed code with the exact reported symptom (the non-deprecated 
alias's value is silently dropped) and passes with the fix.
   - Added a new `apache-rat-plugin` integration test `src/it/RAT-552` with a 
multi-module project combining `excludeSubProjects=true` and a deprecated 
`<excludes>`. It asserts, via the debug build log, that the sub-project's 
exclude pattern is actually accepted (a log line that is completely absent on 
unfixed code), and that the sub-module's files no longer appear in the parent's 
own rat report.
   
   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