[ 
https://issues.apache.org/jira/browse/RAT-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17955824#comment-17955824
 ] 

Claude Warren commented on RAT-476:
-----------------------------------

Currently the include/exclude patterns are separated by level based on where 
the ignore file is relative to the root of the source tree.   The levels are 
processed in reverse order.  The patterns are separated and all includes are 
processed before excluded with the first match being accepted as truth.

So given 3 levels with includes noted as I1, I2, I3 and excludes noted as E1, 
E2, E3.

the current execution pattern is I3, I2, I1, E3, E2, E1.

so files that are explicitly included at higher levels are not overridden by 
excludes at lower levels.

I think this proposal is to shuffle the order of execution to: I3, E3, I2, E2, 
I1, E1

This would allow files that were explicitly included at higher levels can be 
excluded at lower levels.

 

Example:  assume
 # I1 defines **/*.txt,
 # I1 is in directory /L1
 # E3 defines **/*.txt
 # E3 is in directory /L1/L2/L3
 # Assume a candidate file of /L1/L2/L3/my.txt

The I1 include resolves to /L1/**/*.txt

The E3 exclude resolves to /L1/L2/L3/**/*.txt

 

Under the current order

I1 include will execute before E3 and /L1/L2/L3/my.txt will be included even 
though E3 specifically said to exclude it.

 

Under the new order

E3 will execute before I1 and /L1/L2/L3/my.txt will be excluded even though I1 
specifically said to include it.

 

This changes the guidance that once included files can not be excluded, or at 
least requires clarification in the documentation.

 

I think that this change is appropriate.  I do not think there are issues with 
other excluded file processors.  If there are we can add an enumeration specify 
that the include/exclude order should be SHUFFLED or GROUPED and handle the 
order in the abstract builder.

 

> include/exclude precedence rules do not match gitignore semantics
> -----------------------------------------------------------------
>
>                 Key: RAT-476
>                 URL: https://issues.apache.org/jira/browse/RAT-476
>             Project: Apache Rat
>          Issue Type: Improvement
>          Components: core engine
>            Reporter: Arnout Engelen
>            Priority: Major
>
> currently, RAT processes all 'unignore' patterns separately from all 'ignore' 
> patterns, and only takes into account precedence withing those groups. This 
> does not match the gitignore semantics, where ignore/unignore patterns are 
> evaluated on each precedence level. I think it would make sense to align to 
> the gitignore semantics, but possibly we should evaluate if that'd conflict 
> with ignore logic for other VCS'es.
> See discussion in [https://github.com/apache/creadur-rat/pull/433] for 
> background



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to