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

RAT-469: Fixes to correctly detect additional valid licenses #413

Merged
merged 25 commits into from
Jan 12, 2025

Conversation

Claudenw
Copy link
Contributor

@Claudenw Claudenw commented Dec 10, 2024

A regression was spotted when another valid license was configured ..... but not properly reported.

If you configure GPL to be a valid license the recognition failed to pass.

@Claudenw Claudenw requested a review from ottlinger December 10, 2024 17:29
@ottlinger ottlinger changed the title Fixes to correctly detect additional valid licenses RAT-469: Fixes to correctly detect additional valid licenses Dec 11, 2024
@ottlinger
Copy link
Contributor

ottlinger commented Dec 11, 2024

Thanks for raising this issue!

Should we replace all comments in the AbstractRatMojo as
"@deprecated Use <config>." seems to be wrong as the configuration options appear directly under configuration, which is the standard element in Maven plugin configuration.

WDYT?

@ottlinger
Copy link
Contributor

@Claudenw apart from the fact the IT needs to be adapted once the patch is applied I wonder why GPL is not yet recognized and logged explicitly.

@Claudenw
Copy link
Contributor Author

Claudenw commented Dec 11, 2024 via email

@ottlinger
Copy link
Contributor

ottlinger commented Dec 11, 2024

@Claudenw I added GPL as a valid license - I always thought this could be configured and I do not need to add a new defaults.xml file in my project. I used the proposed changes in https://github.com/ottlinger/mailclena/pull/573/files and applied it to an integration test within RAT.

@Claudenw
Copy link
Contributor Author

I think I mistyped. I said "So you have to add to the defaults" when what I meant was you need to add GPL-1, GPL-2, or GPL-3 as an approved license ID or add GPL as an approved license family. The licenses are defined but they are not listed approved.

@Claudenw
Copy link
Contributor Author

Claudenw commented Dec 11, 2024

Should we replace all comments in the AbstractRatMojo as
"@deprecated Use ." seems to be wrong as the configuration options appear directly under configuration, which is the standard element in Maven plugin configuration.

I think we need to step through each of them and make a decision. "" is not always wrong but there are better solutions for most entries.

I think this falls under the documentation verification step that we should get to in mid Jan.

@ottlinger
Copy link
Contributor

If I have a look at the log of the integration test I see:

[WARNING] Duplicate LicenseFamily category: AL    (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: BSD-3 (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: CDDL1 (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: GEN   (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: GPL   (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: MIT   (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: OASIS (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: W3C   (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: W3CD  (action: IGNORE)

could this be the cause for not recognizing GPL but labeling it UNKNOWN?
(apache-rat-plugin/target/invoker/RAT-469/build.log)

@Claudenw
Copy link
Contributor Author

Claudenw commented Dec 12, 2024

First GPL should be recognized as a license FAMILY it is in the default.xml
GPL1, GPL2, and GPL3 should be recognised as license IDs also in the default.xml

[WARNING] Duplicate LicenseFamily category: W3C   (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: W3CD  (action: IGNORE)

This indicates that at least 2 configurations were read and that the LicenseFamilies were defined in both. I don't see how this happens but the warning is there so that if you accidentally overwrite an existing license you get warned.

@ottlinger
Copy link
Contributor

First GPL should be recognized as a license FAMILY it is in the default.xml GPL1, GPL2, and GPL3 should be recognised as license IDs also in the default.xml

[WARNING] Duplicate LicenseFamily category: W3C   (action: IGNORE)
[WARNING] Duplicate LicenseFamily category: W3CD  (action: IGNORE)

This indicates that at least 2 configurations were read and that the LicenseFamilies were defined in both. I don't see how this happens but the warning is there so that if you accidentally overwrite an existing license you get warned.

Just wanted to make sure that the IGNORE does not mean that any such license will be ignored.

@ottlinger
Copy link
Contributor

I merged in master and HeaderCheckWorkerTest is broken.

@Claudenw Is it intended that the license family "unknown" is approved by default?

+++ b/apache-rat-core/src/test/java/org/apache/rat/analysis/HeaderCheckWorkerTest.java
@@ -43,8 +43,8 @@ public class HeaderCheckWorkerTest {
         ILicense matcher = new TestingLicense("test", "test");
         HeaderCheckWorker worker = new HeaderCheckWorker(new TestingMatcher(), new StringReader(""), Lists.list(matcher), subject);
         worker.read();
-        assertThat(subject.getMetaData().unapprovedLicenses().count()).isEqualTo(1);
-        assertThat(subject.getMetaData().unapprovedLicenses().collect(Collectors.toList()).get(0).getLicenseFamily()).isEqualTo(ILicenseFamily.UNKNOWN);
+        assertThat(subject.getMetaData().approvedLicenses().count()).isEqualTo(1);
+        assertThat(subject.getMetaData().approvedLicenses().collect(Collectors.toList()).get(0).getLicenseFamily()).isEqualTo(ILicenseFamily.UNKNOWN);
     }

@Claudenw
Copy link
Contributor Author

Claudenw commented Dec 13, 2024 via email

@Claudenw
Copy link
Contributor Author

Claudenw commented Dec 13, 2024 via email

…s need to be put under the existing configuration instead a newly/non-existing config
@ottlinger
Copy link
Contributor

Should we replace all comments in the AbstractRatMojo as
"@deprecated Use ." seems to be wrong as the configuration options appear directly under configuration, which is the standard element in Maven plugin configuration.

I think we need to step through each of them and make a decision. "" is not always wrong but there are better solutions for most entries.

I think this falls under the documentation verification step that we should get to in mid Jan.

I changed the default text in ef5c93b

@Claudenw Claudenw requested a review from ottlinger January 12, 2025 14:27
Copy link
Contributor

@ottlinger ottlinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for having another deeper look into the matter and for fixing the tests.

@Claudenw Claudenw merged commit 9ddc32a into apache:master Jan 12, 2025
6 checks passed
@ottlinger
Copy link
Contributor

GPL content is still recognised as UNKNOWN even if configured as an approvedLicense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants