-
Notifications
You must be signed in to change notification settings - Fork 44
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-377: Create a STANDARD process filter like the ARCHIVE process switch in RAT-372 #249
Conversation
6487234
to
406d822
Compare
* Specify the processing of STANDARD files. | ||
*/ | ||
static final Option STANDARD = Option.builder().longOpt("standard").hasArg().argName("ProcessingType") | ||
.desc(format("Specifies the level of detail in STANDARD file reporting.. (default is %s)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double dot in this sentence - pls update the site template as well to keep it in sync with your changes.
@@ -74,25 +78,48 @@ public DefaultAnalyser(ReportConfiguration config, final Collection<ILicense> li | |||
this.configuration = config; | |||
} | |||
|
|||
/** | |||
* Generates a predicateo to filter out licnses that should not be reported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LHF: typo predicateo / licnes
apache-rat/src/site/apt/index.apt.vm
Outdated
@@ -106,6 +104,7 @@ usage: java -jar apache-rat/target/apache-rat-${project.version}.jar | |||
external xsl file may be specified or one of the internal named sheets: plain-rat (default), | |||
missing-headers, or unapproved-licenses | |||
--scan-hidden-directories Scan hidden directories | |||
--standard <ProcessingType> Specifies the level of detail in STANDARD file reporting.. (default is ABSENCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LHF: typo - double dot. Should the dot be at the end of the sentence.
src/changes/changes.xml
Outdated
@@ -72,6 +72,15 @@ https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd | |||
</release> | |||
--> | |||
<release version="0.17-SNAPSHOT" date="xxxx-yy-zz" description="Current SNAPSHOT - release to be done"> | |||
<action issue="RAT-377" type="add" dev="claudenw"> | |||
Added ability to specify the leverl of reporting on STANDARD files within a project. This necessitated an addition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LHF: typo leverl ;) Sounds Austrian to my ear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change ... apart from my minor things, looks good to me.
406d822
to
7777690
Compare
I had to rework some code to bring the errors down below the minimum. The net result is a much larger change. You may want to review the last commit. Please reapprove when you are satisfied. |
lastMatch = null; | ||
if (!checked) { | ||
checked = true; | ||
if (line.contains("SPDX-License-Identifier")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we extract this as a constant as it is used in line 62 as well, when defining the pattern?
@@ -75,7 +77,8 @@ public LicenseSetFactory(SortedSet<ILicense> licenses, Collection<String> approv | |||
* @return An empty sorted set of ILicense objects. | |||
*/ | |||
public static SortedSet<ILicense> emptyLicenseSet() { | |||
return new TreeSet<>(ILicense.getComparator()); | |||
//return new TreeSet<>((a,b) -> a.getLicenseFamily().compareTo(b.getLicenseFamily())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LHF: rm old code
public static ILicense search(String licenseId, SortedSet<ILicense> licenses) { | ||
ILicenseFamily searchFamily = ILicenseFamily.builder().setLicenseFamilyCategory(licenseId) | ||
public static Optional<ILicense> search(String familyId, String licenseId, SortedSet<ILicense> licenses) { | ||
// return licenses.stream().filter( l -> l.getId().equals(licenseId)).findFirst(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LHF: rm old code?
@@ -212,13 +221,14 @@ public IHeaderMatcher getMatcher() { | |||
|
|||
/** | |||
* Search a SortedSet of licenses for the matching license. | |||
* License must mach both family code, and license id. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: mach / match
assertTrue(target.matches(AbstractMatcherTest.makeHeaders("SPDX-License-Identifier: hello", null))); | ||
target.reset(); | ||
StringBuilder sb = new StringBuilder() | ||
.append("SPDX-License-Identifier: world").append(System.lineSeparator()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constant from above could be used in these tests as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of the spotbugs findings, only minor things marked in this review run. Thanks again!
Fixes RAT-377
This change is dependent upon RAT-372 and should not be considered for merged until after that change has been accepted.
The solution for process archive files (RAT-372) introduces a command line switch to change from just reporting the presence of archive files to reporting what licenses they contain or reporting licenses contains as well as missing licenses.
This request is for a similar change in STANDARD reporting.
The use case is for non-ASF projects that don't require a license header in every file but do require licensing to be declared within the project.
Using
--standard PRESENCE
would cause Rat to list all the declared licenses in the scan, without the overhead noise of 'missing license headers'