[
https://issues.apache.org/jira/browse/RAT-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18035030#comment-18035030
]
Robert Stupp commented on RAT-476:
----------------------------------
I wonder whether it's possible to apply the "longest pattern takes precedence"
approach. This could work, if all "in/exclude processors" can eventually yield
a list of include and exclude patterns. This would satisfy the the case of
having a "broad" {{.gitignore}}'d {{target/**}} (or Gradle {{build/**}}) to
exclude all generated build files but have a longer
{{build/generated/sources/**}} _include_ pattern to let RAT check the generated
source code as well.
Or RAT could do what the Git ignore rules do, only have a {{--excludes}}
option, and use a leading {{!}} for inclusions, which would allow mixing the
order exclusions and inclusions. It would need to be defined whether the SCM
"processors" run before or after RAT pattern handling.
Another alternative would be the use of "groups", where a group can be a set of
inclusion patterns, a set of exclusion patterns, an SCM "processor" (like
{{.gitignore}} handling).
For the command line:
{code}
java -jar rat.jar \
--excludes E3 \ # patterns group excluding E3
--include-exclude-group git # GIT group
--includes I3 # patterns group including I3
{code}
For Gradle:
{code}
rat {
includeExcludeGroups.add(PatternGroup(excludes = ["E3"]))
includeExcludeGroups.add(Git())
includeExcludeGroups.add(PatternGroup(includes = ["I3"]))
}
{code}
For Maven:
{code}
<configuration>
<includeExcludeGroups>
<exclude>E3</exclude>
<git/>
<include>i3</include>
</includeExcludeGroups>
</configuration>
{code}
Or as an (imaginary) {{.ratignore.json}} (or yaml?):
{code}
{
"includeExcludeGroups": [
{ "type": "patterns", "excludes": ["E3"] },
{ "type": "git" },
{ "type": "patterns", "includes": ["I3"] }
]
}
{code}
> 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)