Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .rat-excludes file to each repository #1613

Open
2 of 6 tasks
tkobayas opened this issue Nov 13, 2024 · 4 comments · Fixed by apache/incubator-kie-drools#6149 · May be fixed by apache/incubator-kie-kogito-runtimes#3714
Open
2 of 6 tasks

Add .rat-excludes file to each repository #1613

tkobayas opened this issue Nov 13, 2024 · 4 comments · Fixed by apache/incubator-kie-drools#6149 · May be fixed by apache/incubator-kie-kogito-runtimes#3714
Assignees

Comments

@tkobayas
Copy link

tkobayas commented Nov 13, 2024

In order to check All files have license headers if necessary. https://kie.apache.org/docs/community/verify/ , add .rat-excludes to the root directory of each repository.

For example, running

java -jar apache-rat-0.16.1.jar -d ./incubator-kie-drools/ -E ./incubator-kie-drools/.rat-excludes | grep "== File:" > kie-drools-rat.txt

can easily confirm license headers.

Each repository committers should add ignorable file names/paths in .rat-excludes.

Note:

  • apache-rat 0.16 supports only filename with regex. e.g. .*\.csv . We cannot express file path.
  • apache-rat 0.17 (as of 2024 Nov 20, it's still SNAPSHOT) supports glob pattern with --input-exclude-file option. e.g. **/optaplanner-examples/data/**/import/**
@jomarko
Copy link

jomarko commented Nov 14, 2024

Thank you @tkobayas, I have something similar in my head longer time. What I see as we should do as part of this ticket is to unify the approach. Because there were already some initiatives to have licenses checks.

apache-rat-plugin

Used for example in kogito-runtimes https://github.com/apache/incubator-kie-kogito-runtimes/blob/main/pom.xml

        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>${version.apache-rat-plugin}</version>
          <configuration>
            <excludes>
              <exclude>.mvn/maven.config</exclude>
              <exclude>**/simple_invalid_migration.invalid</exclude>
              <exclude>**/*.mpf</exclude>
              <exclude>**/src/test/**/*.txt</exclude>
              <exclude>**/.gitkeep</exclude>
              <exclude>**/checkstyle-cachefile</exclude>
              <exclude>**/*.log</exclude>
              <exclude>**/*.lst</exclude>
              <exclude>**/requirements.txt</exclude>
              <exclude>**/*.addon</exclude>
              <exclude>**/*.avsc</exclude>
              <exclude>**/LoanUnit.xls.properties.test</exclude>
              <exclude>**/src_test_resources_application.yml</exclude>
              <exclude>**/BPMN*.xsd</exclude>
              <exclude>**/bpsim.xsd</exclude>
              <exclude>**/DC.xsd</exclude>
              <exclude>**/DI.xsd</exclude>
              <exclude>**/DiagramDefinition.xsd</exclude>
              <exclude>**/DiagramInterchange.xsd</exclude>
              <exclude>**/Semantic.xsd</exclude>
            </excludes>
          </configuration>
        </plugin>

checkstyle.header.template

Used in a lot of our maven projects

    <checkstyle.header.template
    ><![CDATA[
^\/\*$\n^
\* Licensed to the Apache Software Foundation \(ASF\) under one$\n^
\* or more contributor license agreements\.  See the NOTICE file$\n^
\* distributed with this work for additional information$\n^
\* regarding copyright ownership\.  The ASF licenses this file$\n^
\* to you under the Apache License, Version 2\.0 \(the$\n^
\* &quot;License&quot;\); you may not use this file except in compliance$\n^
\* with the License\.  You may obtain a copy of the License at$\n^
\*$\n^
\*   http:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0$\n^
\*$\n^
\* Unless required by applicable law or agreed to in writing,$\n^
\* software distributed under the License is distributed on an$\n^
\* &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY$\n^
\* KIND, either express or implied\.  See the License for the$\n^
\* specific language governing permissions and limitations$\n^
\* under the License\.$\n^
\*\/$
]]>
    </checkstyle.header.template>

I think we should avoid the situation we have in parallel use of:

  • apache-rat-plugin
  • checkstyle.header.template
  • apache-rat java cli tool

I think we should use just one of the above, while the last seems to me as best candidate as it is not bind to maven projects. What is your opinion?

@tkobayas
Copy link
Author

Hi @jomarko

I think we should use just one of the above, while the last seems to me as best candidate as it is not bind to maven projects. What is your opinion?

Yeah, +1 for apache-rat java cli tool.

Indeed, I merged apache/incubator-kie-drools#6149 with removing apache-rat-plugin. I think @baldimir has the same opinion, but it's good to discuss it in dev at kie.apache ML. I'll send an email very soon.

Also thanks for mentioning that checkstyle.header.template can be removed as well.

@LightGuard
Copy link

Also a +1 from me about using the CLI tool.

jomarko added a commit to jomarko/incubator-kie-kogito-images that referenced this issue Nov 15, 2024
This a partial fix for the issue apache/incubator-kie-issues#1613 as we open one PR per repository.
jomarko added a commit to jomarko/kie-tools that referenced this issue Nov 15, 2024
This is partial fix of the issue apache/incubator-kie-issues#1613 as we open one PR per repository.
jomarko added a commit to jomarko/incubator-kie-kogito-images that referenced this issue Nov 18, 2024
This a partial fix for the issue apache/incubator-kie-issues#1613 as we open one PR per repository.
@jomarko
Copy link

jomarko commented Nov 21, 2024

FYI, "kogito-images" will be not updated with "CI :: Check license headers" workflow, see the explanation here apache/incubator-kie-kogito-images#1811 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment