This is an automated email from the ASF dual-hosted git repository.
claude pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
The following commit(s) were added to refs/heads/master by this push:
new 641fc4e1 RAT-453: updated XSLT and example output (#405)
641fc4e1 is described below
commit 641fc4e1db5ecaa0056016ce2082e162ec6a8447
Author: Claude Warren <[email protected]>
AuthorDate: Wed Dec 4 11:33:38 2024 +0000
RAT-453: updated XSLT and example output (#405)
* updated XSLT and example output
* fixed additional tests
* Fixed issues with RAT 259 integration test
* added media type and encoding to report
* RAT-453: Minor fixes, javadoc updates
* Changed display format
---------
Co-authored-by: P. Ottlinger <[email protected]>
---
.../it/resources/ReportTest/RAT_14/verify.groovy | 24 +--
.../it/resources/ReportTest/RAT_259/verify.groovy | 24 +--
.../it/resources/ReportTest/RAT_455/verify.groovy | 2 +-
.../it/resources/ReportTest/RAT_457/verify.groovy | 4 +-
.../main/resources/org/apache/rat/plain-rat.xsl | 225 +++++++++++++++------
apache-rat-core/src/site/apt/index.apt.vm | 2 +-
.../src/test/java/org/apache/rat/ReporterTest.java | 123 +++++------
.../java/org/apache/rat/ReporterTestUtils.java | 28 ++-
apache-rat-plugin/pom.xml | 1 +
apache-rat-plugin/src/it/RAT-168/verify.groovy | 13 +-
apache-rat-plugin/src/it/RAT-314/verify.groovy | 16 +-
apache-rat-plugin/src/it/it1/verify.groovy | 9 +-
.../main/java/org/apache/rat/mp/RatCheckMojo.java | 4 +-
.../java/org/apache/rat/mp/RatCheckMojoTest.java | 81 ++++----
.../java/org/apache/rat/anttasks/ReportTest.java | 4 +-
.../resources/antunit/report-normal-operation.xml | 14 --
apache-rat-tools/pom.xml | 1 -
apache-rat-tools/src/main/resources/Ant.tpl | 2 +-
apache-rat-tools/src/main/resources/Maven.tpl | 3 +-
apache-rat-tools/src/main/resources/ant/report.tpl | 14 --
apache-rat/README-ANT.txt | 2 +-
apache-rat/src/site/apt/index.apt.vm | 2 +-
apache-rat/src/site/apt/output/example.apt | 144 ++++++++-----
apache-rat/src/site/examples/default_output.txt | 118 +++++++----
apache-rat/src/site/examples/rat-report.txt | 193 +++++++-----------
src/changes/changes.xml | 3 +
src/python/recursive-rat.py | 4 +-
src/site/apt/index.apt.vm | 2 +-
28 files changed, 593 insertions(+), 469 deletions(-)
diff --git a/apache-rat-core/src/it/resources/ReportTest/RAT_14/verify.groovy
b/apache-rat-core/src/it/resources/ReportTest/RAT_14/verify.groovy
index cc2ec991..7598dd40 100644
--- a/apache-rat-core/src/it/resources/ReportTest/RAT_14/verify.groovy
+++ b/apache-rat-core/src/it/resources/ReportTest/RAT_14/verify.groovy
@@ -29,17 +29,17 @@ import static org.junit.jupiter.api.Assertions.assertNotNull
output = new File(args[0])
content = output.text
-TextUtils.assertPatternInTarget("^Approved:\\s+4 ", content)
-TextUtils.assertPatternInTarget("^Archives:\\s+2 ", content)
-TextUtils.assertPatternInTarget("^Binaries:\\s+2 ", content)
-TextUtils.assertPatternInTarget("^Document types:\\s+5 ", content)
-TextUtils.assertPatternInTarget("^Generated:\\s+1 ", content)
-TextUtils.assertPatternInTarget("^License categories:\\s+3 ", content)
-TextUtils.assertPatternInTarget("^License names:\\s+3 ", content)
-TextUtils.assertPatternInTarget("^Notices:\\s+1 ", content)
-TextUtils.assertPatternInTarget("^Standards: \\s+5 ", content)
-TextUtils.assertPatternInTarget("^Unapproved:\\s+2 ", content)
-TextUtils.assertPatternInTarget("^Unknown:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Approved:\\s+4 ", content)
+TextUtils.assertPatternInTarget("^ Archives:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Binaries:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Document types:\\s+5 ", content)
+TextUtils.assertPatternInTarget("^ Generated:\\s+1 ", content)
+TextUtils.assertPatternInTarget("^ License categories:\\s+3 ", content)
+TextUtils.assertPatternInTarget("^ License names:\\s+3 ", content)
+TextUtils.assertPatternInTarget("^ Notices:\\s+1 ", content)
+TextUtils.assertPatternInTarget("^ Standards: \\s+5 ", content)
+TextUtils.assertPatternInTarget("^ Unapproved:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Unknown:\\s+2 ", content)
logOutput = new File(args[1])
log = logOutput.text
@@ -80,4 +80,4 @@ assertEquals(3,
statistic.getCounter(ClaimStatistic.Counter.LICENSE_NAMES))
assertEquals(1, statistic.getCounter(ClaimStatistic.Counter.NOTICES))
assertEquals(5, statistic.getCounter(ClaimStatistic.Counter.STANDARDS))
assertEquals(2, statistic.getCounter(ClaimStatistic.Counter.UNAPPROVED))
-assertEquals(2, statistic.getCounter(ClaimStatistic.Counter.UNKNOWN))
\ No newline at end of file
+assertEquals(2, statistic.getCounter(ClaimStatistic.Counter.UNKNOWN))
diff --git a/apache-rat-core/src/it/resources/ReportTest/RAT_259/verify.groovy
b/apache-rat-core/src/it/resources/ReportTest/RAT_259/verify.groovy
index 7427c558..e1573bf3 100644
--- a/apache-rat-core/src/it/resources/ReportTest/RAT_259/verify.groovy
+++ b/apache-rat-core/src/it/resources/ReportTest/RAT_259/verify.groovy
@@ -21,20 +21,20 @@ import org.apache.rat.testhelpers.TextUtils
output = new File(args[0])
content = output.text
-TextUtils.assertPatternInTarget("^Approved:\\s+9 ", content)
-TextUtils.assertPatternInTarget("^Archives:\\s+1 ", content)
-TextUtils.assertPatternInTarget("^Binaries:\\s+2 ", content)
-TextUtils.assertPatternInTarget("^Document types:\\s+5 ", content)
-TextUtils.assertPatternInTarget("^Generated:\\s+1 ", content)
-TextUtils.assertPatternInTarget("^License categories:\\s+5 ", content)
-TextUtils.assertPatternInTarget("^License names:\\s+6 ", content)
-TextUtils.assertPatternInTarget("^Notices:\\s+2 ", content)
-TextUtils.assertPatternInTarget("^Standards:\\s+8 ", content)
-TextUtils.assertPatternInTarget("^Unapproved:\\s+2 ", content)
-TextUtils.assertPatternInTarget("^Unknown:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Approved:\\s+9 ", content)
+TextUtils.assertPatternInTarget("^ Archives:\\s+1 ", content)
+TextUtils.assertPatternInTarget("^ Binaries:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Document types:\\s+5 ", content)
+TextUtils.assertPatternInTarget("^ Generated:\\s+1 ", content)
+TextUtils.assertPatternInTarget("^ License categories:\\s+5 ", content)
+TextUtils.assertPatternInTarget("^ License names:\\s+6", content)
+TextUtils.assertPatternInTarget("^ Notices:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Standards:\\s+8 ", content)
+TextUtils.assertPatternInTarget("^ Unapproved:\\s+2 ", content)
+TextUtils.assertPatternInTarget("^ Unknown:\\s+2 ", content)
logOutput = new File(args[1])
log = logOutput.text
TextUtils.assertPatternNotInTarget("^ERROR:", log)
-TextUtils.assertPatternNotInTarget("^WARN:", log)
\ No newline at end of file
+TextUtils.assertPatternNotInTarget("^WARN:", log)
diff --git a/apache-rat-core/src/it/resources/ReportTest/RAT_455/verify.groovy
b/apache-rat-core/src/it/resources/ReportTest/RAT_455/verify.groovy
index 7384636d..ea4dd6b8 100644
--- a/apache-rat-core/src/it/resources/ReportTest/RAT_455/verify.groovy
+++ b/apache-rat-core/src/it/resources/ReportTest/RAT_455/verify.groovy
@@ -21,5 +21,5 @@ import org.apache.rat.testhelpers.TextUtils
output = new File(args[0])
content = output.text
-assert content.contains('!S /GPL.md')
+assert TextUtils.isMatching('^! /GPL.md\\s+S ', content)
assert TextUtils.isMatching('^\\s+GPL\\s+GPL1\\s+GNU General Public License
V1.0 \\(Unapproved\\)', content)
diff --git a/apache-rat-core/src/it/resources/ReportTest/RAT_457/verify.groovy
b/apache-rat-core/src/it/resources/ReportTest/RAT_457/verify.groovy
index 4507f92f..0c39b7dd 100644
--- a/apache-rat-core/src/it/resources/ReportTest/RAT_457/verify.groovy
+++ b/apache-rat-core/src/it/resources/ReportTest/RAT_457/verify.groovy
@@ -21,9 +21,9 @@ import org.apache.rat.testhelpers.TextUtils
output = new File(args[0])
content = output.text
-assert content.contains('!A /apache-rat-0.17-SNAPSHOT.jar')
+assert TextUtils.isMatching('^! /apache-rat-0.17-SNAPSHOT.jar\\s+A ', content)
logOutput = new File(args[1])
log = logOutput.text
-TextUtils.assertPatternInTarget("^INFO:\\s+Archives:\\s+1\$", log)
+assert TextUtils.isMatching("^INFO:\\s+Archives:\\s+1\$", log)
diff --git a/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
b/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
index c1e0f3d4..d7a3fed0 100644
--- a/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
+++ b/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
@@ -19,60 +19,95 @@
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:variable name='newline'><xsl:text>
</xsl:text></xsl:variable>
-
-<xsl:output method='text'/>
-<xsl:template match='/'>
-*****************************************************
-Summary
-*****************************************************
-Generated at: <xsl:value-of select='rat-report/@timestamp'/>
-
-Counters:
- <xsl:for-each select='descendant::statistic'>
- <xsl:value-of select='concat($newline, substring(concat(@name, ":
"), 1, 20),
- @count)' />
- <xsl:if test='@approval="false"'> (Exceeded limits)</xsl:if>
- <xsl:value-of select='concat(" ", @description)' />
- </xsl:for-each>
-
-
-Licenses detected:
- <xsl:for-each select='descendant::licenseName'>
- <xsl:value-of select='concat($newline, @name, ": ", @count, " ")' />
- </xsl:for-each>
-
-License Categories detected:
- <xsl:for-each select='descendant::licenseCategory'>
- <xsl:value-of select='concat($newline, @name, ": ", @count, " ")' />
- </xsl:for-each>
-
-Document Types detected:
- <xsl:for-each select='descendant::documentType'>
- <xsl:value-of select='concat($newline, @name, ": ", @count, " ")' />
- </xsl:for-each>
-
-<xsl:if test="descendant::resource[license/@approval='false']">
-
-*****************************************************
-
-Files with unapproved licenses:
-
-<xsl:for-each select='descendant::resource[license/@approval="false"]'>
- <xsl:value-of select='concat(" ",@name, $newline)'/>
-</xsl:for-each>
-*****************************************************
-</xsl:if>
-<xsl:if test="descendant::resource[@type='ARCHIVE']">
-Archives:
-<xsl:for-each select='descendant::resource[@type="ARCHIVE"]'>
- <xsl:value-of select='concat(" ", @name, $newline)'/>
-</xsl:for-each>
-</xsl:if>
-<xsl:text>
-*****************************************************
+ <xsl:variable name='newline'>
+ <xsl:text>
</xsl:text>
+ </xsl:variable>
+ <xsl:variable name="sectionPartition">
+
<xsl:text>*****************************************************</xsl:text>
+ </xsl:variable>
+ <xsl:variable name="subsectionPartition">
+
<xsl:text>-----------------------------------------------------</xsl:text>
+ </xsl:variable>
+
+ <xsl:output method='text'/>
+ <xsl:template match='/'>
+ <xsl:call-template name="section">
+ <xsl:with-param name="title">Summary</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select='concat("Generated at: ", rat-report/@timestamp,
$newline, " by ",
+ rat-report/version/@product, " ", rat-report/version/@version, " (",
rat-report/version/@vendor, ")")'/>
+
+ <xsl:call-template name="subsection">
+ <xsl:with-param name="title">Counters</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:text> (Entries starting with '!' exceed the minimum or maximum
values)</xsl:text>
+ <xsl:value-of select='$newline'/>
+ <xsl:for-each select='descendant::statistic'>
+ <xsl:call-template name="statistic">
+ <xsl:with-param name="name"><xsl:value-of
select="@name"/></xsl:with-param>
+ <xsl:with-param name="count"><xsl:value-of
select="@count"/></xsl:with-param>
+ <xsl:with-param name="description"><xsl:value-of
select="@description"/></xsl:with-param>
+ <xsl:with-param name="prefix"><xsl:choose>
+ <xsl:when test='@approval="false"'><xsl:text>!
</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>
+ </xsl:choose></xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <xsl:call-template name="subsection">
+ <xsl:with-param name="title">Licenses detected</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:for-each select='descendant::licenseName'>
+ <xsl:value-of select='concat($newline, @name, ": ", @count, " ")'/>
+ </xsl:for-each>
+
+ <xsl:call-template name="subsection">
+ <xsl:with-param name="title">License Categories
detected</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:for-each select='descendant::licenseCategory'>
+ <xsl:value-of select='concat($newline, @name, ": ", @count, " ")'/>
+ </xsl:for-each>
+
+ <xsl:call-template name="subsection">
+ <xsl:with-param name="title">Document Types
detected</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:for-each select='descendant::documentType'>
+ <xsl:value-of select='concat($newline, @name, ": ", @count, " ")'/>
+ </xsl:for-each>
+
+ <xsl:if test="descendant::resource[license/@approval='false']">
+ <xsl:value-of select="concat($newline, $newline)" />
+ <xsl:call-template name="section">
+ <xsl:with-param name="title">Files with unapproved
licenses</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:for-each
select='descendant::resource[license/@approval="false"]'>
+ <xsl:value-of select='concat($newline, " ", @name)'/>
+ </xsl:for-each>
+
+ </xsl:if>
+
+ <xsl:if test="descendant::resource[@type='ARCHIVE']">
+ <xsl:value-of select="concat($newline, $newline)" />
+ <xsl:call-template name="section">
+ <xsl:with-param name="title">Archives</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:for-each select='descendant::resource[@type="ARCHIVE"]'>
+ <xsl:value-of select='concat($newline, " ", @name)'/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:value-of select="concat($newline, $newline)" />
+ <xsl:call-template name="section">
+ <xsl:with-param name="title">Detail</xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>
Documents with unapproved licenses will start with a '!'
- The next character identifies the document type.
+ The first character on the next line identifies the document type.
char type
A Archive file
@@ -83,18 +118,74 @@ Archives:
U Unknown file.
</xsl:text>
- <xsl:for-each select='descendant::resource'>
- <xsl:choose>
- <xsl:when test='license/@approval="false"'><xsl:value-of
select='concat($newline, "!")'/></xsl:when>
- <xsl:otherwise><xsl:value-of select='concat($newline, "
")'/></xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select='concat(substring(@type, 1, 1), " ", @name)'/>
- <xsl:for-each select='descendant::license'>
- <xsl:value-of select='concat($newline, " ",
substring(concat(@family, " "), 1, 5),
- " ", substring(concat(@id, " "), 1,10), " ", @name)'/>
- <xsl:if test="@approval='false'"> (Unapproved)</xsl:if>
- </xsl:for-each>
- </xsl:for-each>
-*****************************************************
-</xsl:template>
+ <xsl:for-each select='descendant::resource'>
+ <xsl:call-template name="document">
+ <xsl:with-param name="name"><xsl:value-of
select='@name'/></xsl:with-param>
+ <xsl:with-param name="mediaType"><xsl:value-of
select='@mediaType'/></xsl:with-param>
+ <xsl:with-param name="encoding"><xsl:value-of
select='@encoding'/></xsl:with-param>
+ <xsl:with-param name="type"><xsl:value-of
select="substring(@type, 1, 1)"/></xsl:with-param>
+ <xsl:with-param name="prefix"><xsl:choose>
+ <xsl:when test='license/@approval="false"'>
+ <xsl:text>! </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose></xsl:with-param>
+ </xsl:call-template>
+ <xsl:for-each select='descendant::license'>
+ <xsl:call-template name="license">
+ <xsl:with-param name="name"><xsl:value-of
select='@name'/></xsl:with-param>
+ <xsl:with-param name="id"><xsl:value-of
select='@id'/></xsl:with-param>
+ <xsl:with-param name="family"><xsl:value-of
select='@family'/></xsl:with-param>
+ <xsl:with-param name="approval"><xsl:value-of
select='@approval'/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:value-of select='concat($newline, $newline)' />
+ </xsl:for-each>
+ <xsl:value-of select='$newline'/>
+ </xsl:template>
+
+ <xsl:template name="section">
+ <xsl:param name="title"/>
+ <xsl:value-of
+ select='concat($sectionPartition, $newline, $title, $newline,
$sectionPartition, $newline)'/>
+ </xsl:template>
+
+ <xsl:template name="subsection">
+ <xsl:param name="title"/>
+ <xsl:value-of
+ select='concat($newline, $newline, $subsectionPartition,
$newline, $title, $newline, $subsectionPartition, $newline)'/>
+ </xsl:template>
+
+ <xsl:template name="statistic">
+ <xsl:param name="name" />
+ <xsl:param name="count" />
+ <xsl:param name="description" />
+ <xsl:param name="prefix"/>
+
+ <xsl:value-of select='concat($prefix, substring(concat($name, ":
"), 1, 20),
+ $count, " ", $description, $newline)'/>
+ </xsl:template>
+
+ <xsl:template name="document">
+ <xsl:param name="name"/>
+ <xsl:param name="type"/>
+ <xsl:param name="mediaType"/>
+ <xsl:param name="encoding" />
+ <xsl:param name="prefix"/>
+
+ <xsl:value-of select='concat($prefix, $name, $newline, " ", $type, "
", $mediaType, " ",$encoding)'/>
+ </xsl:template>
+
+ <xsl:template name="license">
+ <xsl:param name="family"/>
+ <xsl:param name="id"/>
+ <xsl:param name="name"/>
+ <xsl:param name="approval"/>
+
+ <xsl:value-of select='concat($newline, " ",
substring(concat($family, " "), 1, 5),
+ " ", substring(concat($id, " "), 1,10), " ", $name)'/>
+ <xsl:if test="$approval='false'"> (Unapproved)</xsl:if>
+ </xsl:template>
</xsl:stylesheet>
diff --git a/apache-rat-core/src/site/apt/index.apt.vm
b/apache-rat-core/src/site/apt/index.apt.vm
index c5eb734e..fbd960c9 100644
--- a/apache-rat-core/src/site/apt/index.apt.vm
+++ b/apache-rat-core/src/site/apt/index.apt.vm
@@ -46,7 +46,7 @@ Developing Rat
*----------+--------------+----------------+
<<Modules that run Rat>>
- Support for new build tools and alternative ways to run rat should be coded
+ Support for new build tools and alternative ways to run RAT should be coded
in new modules building on <<<apache-rat-core>>>. Developers interested in
improving existing support for a specific build tool should start by taking
a look at that module.
diff --git a/apache-rat-core/src/test/java/org/apache/rat/ReporterTest.java
b/apache-rat-core/src/test/java/org/apache/rat/ReporterTest.java
index 11c591a1..f2364096 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/ReporterTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/ReporterTest.java
@@ -18,10 +18,10 @@
*/
package org.apache.rat;
+
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Fail.fail;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -86,26 +86,26 @@ public class ReporterTest {
ReportConfiguration config = OptionCollection.createConfiguration(cl);
ClaimStatistic statistic = new Reporter(config).execute();
- assertEquals(1, statistic.getCounter(Type.ARCHIVE));
- assertEquals(2, statistic.getCounter(Type.BINARY));
- assertEquals(1, statistic.getCounter(Type.GENERATED));
- assertEquals(2, statistic.getCounter(Type.NOTICE));
- assertEquals(8, statistic.getCounter(Type.STANDARD));
- assertEquals(0, statistic.getCounter(Type.UNKNOWN));
- assertEquals(9, statistic.getCounter(ClaimStatistic.Counter.APPROVED));
- assertEquals(1, statistic.getCounter(ClaimStatistic.Counter.ARCHIVES));
- assertEquals(2, statistic.getCounter(ClaimStatistic.Counter.BINARIES));
- assertEquals(5,
statistic.getCounter(ClaimStatistic.Counter.DOCUMENT_TYPES));
- assertEquals(1,
statistic.getCounter(ClaimStatistic.Counter.GENERATED));
- assertEquals(5,
statistic.getCounter(ClaimStatistic.Counter.LICENSE_CATEGORIES));
- assertEquals(6,
statistic.getCounter(ClaimStatistic.Counter.LICENSE_NAMES));
- assertEquals(2, statistic.getCounter(ClaimStatistic.Counter.NOTICES));
- assertEquals(8,
statistic.getCounter(ClaimStatistic.Counter.STANDARDS));
- assertEquals(2,
statistic.getCounter(ClaimStatistic.Counter.UNAPPROVED));
- assertEquals(2, statistic.getCounter(ClaimStatistic.Counter.UNKNOWN));
+ assertThat(statistic.getCounter(Type.ARCHIVE)).isEqualTo(1);
+ assertThat(statistic.getCounter(Type.BINARY)).isEqualTo(2);
+ assertThat(statistic.getCounter(Type.GENERATED)).isEqualTo(1);
+ assertThat(statistic.getCounter(Type.NOTICE)).isEqualTo(2);
+ assertThat(statistic.getCounter(Type.STANDARD)).isEqualTo(8);
+ assertThat(statistic.getCounter(Type.UNKNOWN)).isEqualTo(0);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.APPROVED)).isEqualTo(9);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.ARCHIVES)).isEqualTo(1);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.BINARIES)).isEqualTo(2);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.DOCUMENT_TYPES)).isEqualTo(5);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.GENERATED)).isEqualTo(1);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.LICENSE_CATEGORIES)).isEqualTo(5);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.LICENSE_NAMES)).isEqualTo(6);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.NOTICES)).isEqualTo(2);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.STANDARDS)).isEqualTo(8);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.UNAPPROVED)).isEqualTo(2);
+
assertThat(statistic.getCounter(ClaimStatistic.Counter.UNKNOWN)).isEqualTo(2);
List<Type> typeList = statistic.getDocumentTypes();
- assertEquals(Arrays.asList(Type.ARCHIVE, Type.BINARY, Type.GENERATED,
Type.NOTICE, Type.STANDARD), typeList);
+ assertThat(typeList).isEqualTo(Arrays.asList(Type.ARCHIVE,
Type.BINARY, Type.GENERATED, Type.NOTICE, Type.STANDARD));
TreeMap<String, Integer> expected = new TreeMap<>();
expected.put("Unknown license", 2);
@@ -119,7 +119,7 @@ public class ReporterTest {
for (String licenseName : statistic.getLicenseNames()) {
actual.put(licenseName,
statistic.getLicenseNameCount(licenseName));
}
- assertEquals(expected, actual);
+ assertThat(actual).isEqualTo(expected);
expected.clear();
expected.put("?????", 2);
@@ -131,7 +131,7 @@ public class ReporterTest {
for (String licenseCategory : statistic.getLicenseFamilyCategories()) {
actual.put(licenseCategory,
statistic.getLicenseCategoryCount(licenseCategory));
}
- assertEquals(expected, actual);
+ assertThat(actual).isEqualTo(expected);
}
@Test
@@ -140,11 +140,11 @@ public class ReporterTest {
CommandLine commandLine = new
DefaultParser().parse(OptionCollection.buildOptions(), new String[]{"-o",
output.getCanonicalPath(), basedir});
ReportConfiguration config =
OptionCollection.createConfiguration(commandLine);
new Reporter(config).output();
- assertTrue(output.exists());
+ assertThat(output.exists()).isTrue();
String content = FileUtils.readFileToString(output,
StandardCharsets.UTF_8);
- TextUtils.assertPatternInTarget("^Unapproved:\\s*2 ", content);
- assertTrue(content.contains("/Source.java"));
- assertTrue(content.contains("/sub/Empty.txt"));
+ TextUtils.assertPatternInTarget("^! Unapproved:\\s*2 ", content);
+ assertThat(content).contains("/Source.java");
+ assertThat(content).contains("/sub/Empty.txt");
}
@Test
@@ -160,7 +160,7 @@ public class ReporterTest {
} finally {
System.setOut(origin);
}
- assertTrue(output.exists());
+ assertThat(output).exists();
String content = FileUtils.readFileToString(output,
StandardCharsets.UTF_8);
verifyStandardContent(content);
}
@@ -173,49 +173,49 @@ public class ReporterTest {
ReportConfiguration config =
OptionCollection.createConfiguration(commandLine);
new Reporter(config).output();
- assertTrue(output.exists());
+ assertThat(output).exists();
Document doc =
XmlUtils.toDom(java.nio.file.Files.newInputStream(output.toPath()));
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource/license[@approval='false']");
- assertEquals(2, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(2);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource/license[@id='AL']");
- assertEquals(5, nodeList.getLength());
+
+ assertThat(nodeList.getLength()).isEqualTo(5);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource/license[@id='MIT']");
- assertEquals(1, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(1);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource/license[@id='BSD-3']");
- assertEquals(1, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(1);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource/license[@id='TMF']");
- assertEquals(1, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(1);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource/license[@id='?????']");
- assertEquals(2, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(2);
- // GENERATED, UNKNOWN, ARCHIVE, NOTICE, BINARY, STANDARD
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource[@type='STANDARD']");
- assertEquals(8, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(8);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource[@type='ARCHIVE']");
- assertEquals(1, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(1);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource[@type='BINARY']");
- assertEquals(2, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(2);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource[@type='GENERATED']");
- assertEquals(1, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(1);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource[@type='UNKNOWN']");
- assertEquals(0, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(0);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource[@type='NOTICE']");
- assertEquals(2, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(2);
nodeList = XmlUtils.getNodeList(doc, xPath,
"/rat-report/resource[@type='GENERATED']/license/notes");
- assertEquals(1, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(1);
}
/**
@@ -259,13 +259,13 @@ public class ReporterTest {
}
private void verifyStandardContent(final String document) {
- TextUtils.assertPatternInTarget("^Notices:\\s*2 ", document);
- TextUtils.assertPatternInTarget("^Binaries:\\s*2 ", document);
- TextUtils.assertPatternInTarget("^Archives:\\s*1 ", document);
- TextUtils.assertPatternInTarget("^Standards:\\s*8 ", document);
- TextUtils.assertPatternInTarget("^Generated:\\s*1 ", document);
- TextUtils.assertPatternInTarget("^Unapproved:\\s*2 ", document);
- TextUtils.assertPatternInTarget("^Unknown:\\s*2 ", document);
+ TextUtils.assertPatternInTarget("^ Notices:\\s*2 ", document);
+ TextUtils.assertPatternInTarget("^ Binaries:\\s*2 ", document);
+ TextUtils.assertPatternInTarget("^ Archives:\\s*1 ", document);
+ TextUtils.assertPatternInTarget("^ Standards:\\s*8 ", document);
+ TextUtils.assertPatternInTarget("^ Generated:\\s*1 ", document);
+ TextUtils.assertPatternInTarget("^! Unapproved:\\s*2 ", document);
+ TextUtils.assertPatternInTarget("^ Unknown:\\s*2 ", document);
TextUtils.assertPatternInTarget("^Apache License Version 2.0: 5 ",
document);
TextUtils.assertPatternInTarget("^BSD 3 clause: 1 ", document);
@@ -281,7 +281,7 @@ public class ReporterTest {
TextUtils.assertPatternInTarget("^MIT : 1 ", document);
TextUtils.assertPatternInTarget(
- "^Files with unapproved licenses:\\s+" //
+ "^Files with unapproved licenses\\s+\\*+\\s+" //
+ "\\Q/Source.java\\E\\s+" //
+ "\\Q/sub/Empty.txt\\E\\s",
document);
@@ -356,7 +356,7 @@ public class ReporterTest {
checkNode(doc, xPath, "/generated.txt", new LicenseInfo("GEN", true,
true),
"GENERATED");
NodeList nodeList = (NodeList)
xPath.compile("/rat-report/resource").evaluate(doc, XPathConstants.NODESET);
- assertEquals(14, nodeList.getLength());
+ assertThat(nodeList.getLength()).isEqualTo(14);
Validator validator = initValidator();
try {
validator.validate(new DOMSource(doc));
@@ -366,10 +366,10 @@ public class ReporterTest {
}
private static final String NL = System.lineSeparator();
- private static final String PARAGRAPH =
"*****************************************************";
- private static final String HEADER = NL + PARAGRAPH + NL + //
+ private static final String SEPARATOR =
"*****************************************************";
+ private static final String HEADER = SEPARATOR + NL + //
"Summary" + NL + //
- PARAGRAPH + NL + //
+ SEPARATOR + NL + //
"Generated at: ";
@Test
@@ -383,7 +383,8 @@ public class ReporterTest {
String document = out.toString();
TextUtils.assertNotContains("<?xml version=\"1.0\"
encoding=\"UTF-8\"?>", document);
- assertTrue(document.startsWith(HEADER), "'Generated at' is not present
in " + document);
+ assertThat(document).as(() -> "'Generated at' is not present in \n" +
document).startsWith(HEADER);
+
verifyStandardContent(document);
}
@@ -409,15 +410,17 @@ public class ReporterTest {
ReportConfiguration config = initializeConfiguration();
Reporter reporter = new Reporter(config);
reporter.output();
- assertTrue(config.getClaimValidator().hasErrors());
-
assertFalse(config.getClaimValidator().isValid(ClaimStatistic.Counter.UNAPPROVED,
reporter.getClaimsStatistic().getCounter(ClaimStatistic.Counter.UNAPPROVED)));
+ assertThat(config.getClaimValidator().hasErrors()).isTrue();
+
assertThat(config.getClaimValidator().isValid(ClaimStatistic.Counter.UNAPPROVED,
reporter.getClaimsStatistic().getCounter(ClaimStatistic.Counter.UNAPPROVED)))
+ .isFalse();
config = initializeConfiguration();
config.getClaimValidator().setMax(ClaimStatistic.Counter.UNAPPROVED,
2);
reporter = new Reporter(config);
reporter.output();
- assertFalse(config.getClaimValidator().hasErrors());
-
assertTrue(config.getClaimValidator().isValid(ClaimStatistic.Counter.UNAPPROVED,
reporter.getClaimsStatistic().getCounter(ClaimStatistic.Counter.UNAPPROVED)));
+ assertThat(config.getClaimValidator().hasErrors()).isFalse();
+
assertThat(config.getClaimValidator().isValid(ClaimStatistic.Counter.UNAPPROVED,
reporter.getClaimsStatistic().getCounter(ClaimStatistic.Counter.UNAPPROVED)))
+ .isTrue();
}
private static class LicenseInfo {
diff --git
a/apache-rat-core/src/test/java/org/apache/rat/ReporterTestUtils.java
b/apache-rat-core/src/test/java/org/apache/rat/ReporterTestUtils.java
index 068d0422..c47fcc62 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/ReporterTestUtils.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/ReporterTestUtils.java
@@ -35,13 +35,13 @@ public final class ReporterTestUtils {
}
/**
* Generates the regex string for a document output line. Suitable for
regex query.
- * @param approved True if this license is approved
+ * @param approved {@code True} if this license is approved
* @param type The document type.
- * @param name Then name of the document
+ * @param name The name of the document.
* @return the regular expression string representing the document.
*/
public static String documentOut(final boolean approved, final
Document.Type type, final String name) {
- return String.format("^\\Q%s%s %s\\E$", approved ? " " : "!",
type.name().charAt(0), name);
+ return String.format("^%s \\Q%s\\E\\s+ %s [^$]+$", approved ? " " :
"!", name, type.name().charAt(0) );
}
/**
@@ -65,16 +65,32 @@ public final class ReporterTestUtils {
return String.format("\\s+\\Q%s\\E\\s+\\Q%s\\E\\s+\\Q%s\\E$", family,
id, name);
}
- public static String counterText(ClaimStatistic.Counter counter, int
count) {
- return String.format("^%s:\\s*%s ", counter.displayName(), count);
+ /**
+ * Renders report contents of a given counter value, including handling of
negation.
+ * @param counter The expected type of counter in the report.
+ * @param count The expected number of occurrences of the given counter.
+ * @param error {@code True} if the counter does exceed a minimum or
maximum value.
+ * @return the report contents of the given counter.
+ */
+ public static String counterText(ClaimStatistic.Counter counter, int
count, boolean error) {
+ return String.format("^%s %s:\\s*%s ", error ? "!" : " ",
counter.displayName(), count);
}
+ /**
+ * Generates the report contents for Apache 2.0 licenses.
+ * @param count The expected number of occurrences of the license.
+ * @return Report contents for Apache 2.0 licenses in the report.
+ */
public static String apacheLicenseVersion2(int count) {
return String.format("^Apache License Version 2.0: %s ", count);
}
+ /**
+ * Generates the report contents for unknown licenses.
+ * @param count The expected number of occurrences of the license.
+ * @return Report contents for unknown licenses in the report.
+ */
public static String unknownLicense(int count) {
return String.format("^Unknown license: %s ", count);
}
-
}
diff --git a/apache-rat-plugin/pom.xml b/apache-rat-plugin/pom.xml
index 739982a2..88709167 100644
--- a/apache-rat-plugin/pom.xml
+++ b/apache-rat-plugin/pom.xml
@@ -219,6 +219,7 @@
<configuration>
<cloneProjectsTo>${project.build.directory}/invoker</cloneProjectsTo>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <addTestClassPath>true</addTestClassPath>
<settingsFile>src/it/settings.xml</settingsFile>
<postBuildHookScript>verify</postBuildHookScript>
</configuration>
diff --git a/apache-rat-plugin/src/it/RAT-168/verify.groovy
b/apache-rat-plugin/src/it/RAT-168/verify.groovy
index d769a0b4..afc7a52d 100644
--- a/apache-rat-plugin/src/it/RAT-168/verify.groovy
+++ b/apache-rat-plugin/src/it/RAT-168/verify.groovy
@@ -14,13 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-content = new File( basedir, 'build.log' ).text
+import org.apache.rat.testhelpers.TextUtils
-assert content.contains( 'BUILD SUCCESS' )
+content = new File(basedir, 'build.log').text
-assert ! content.contains( '[WARNING] No resources included' )
+assert content.contains('BUILD SUCCESS')
-report = new File( basedir, 'target/site/rat-report.html' ).text
+assert ! content.contains('[WARNING] No resources included')
-assert report.contains( ' S /pom.xml' )
-assert report.contains( ' AL AL Apache License Version 2.0'
)
+report = new File(basedir, 'target/site/rat-report.html').text
+assert TextUtils.isMatching("^ /pom.xml\\s+S ", report)
+assert report.contains(' AL AL Apache License Version 2.0')
diff --git a/apache-rat-plugin/src/it/RAT-314/verify.groovy
b/apache-rat-plugin/src/it/RAT-314/verify.groovy
index 38d1672c..98492857 100644
--- a/apache-rat-plugin/src/it/RAT-314/verify.groovy
+++ b/apache-rat-plugin/src/it/RAT-314/verify.groovy
@@ -14,14 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-content = new File( basedir, 'build.log' ).text
+import org.apache.rat.testhelpers.TextUtils
-assert content.contains( 'BUILD SUCCESS' )
+content = new File(basedir, 'build.log').text
-assert ! content.contains( '[WARNING] No resources included' )
+assert content.contains('BUILD SUCCESS')
-report = new File( basedir, 'target/site/rat-report.html' ).text
+assert ! content.contains('[WARNING] No resources included')
-assert !report.contains( 'Unknown License' )
-assert report.contains( 'S /pom.xml' )
-assert report.contains( 'AL AL Apache License Version 2.0' )
+report = new File(basedir, 'target/site/rat-report.html').text
+
+assert !report.contains('Unknown License')
+assert TextUtils.isMatching("^ /pom.xml\\s+S ", report)
+assert report.contains('AL AL Apache License Version 2.0')
diff --git a/apache-rat-plugin/src/it/it1/verify.groovy
b/apache-rat-plugin/src/it/it1/verify.groovy
index f99dcf30..3dcec9d4 100644
--- a/apache-rat-plugin/src/it/it1/verify.groovy
+++ b/apache-rat-plugin/src/it/it1/verify.groovy
@@ -14,12 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import org.apache.rat.testhelpers.TextUtils
-f = new File( basedir, 'target/rat.txt' )
+f = new File(basedir, 'target/rat.txt')
assert f.exists()
content = f.text
-assert content.contains( ' G /src.apt' )
-assert content.contains( ' YAL MyLicense Yet another license' )
-assert content.contains( ' GEN Not Not ')
+assert TextUtils.isMatching("^ /src.apt\\s+G ", content)
+assert content.contains(' YAL MyLicense Yet another license')
+assert content.contains(' GEN Not Not ')
diff --git
a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
index 05bdb3d9..13631978 100644
--- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
+++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
@@ -131,7 +131,7 @@ public class RatCheckMojo extends AbstractRatMojo {
}
/**
- * Will ignore rat errors and display a log message if any. Its use is NOT
+ * Will ignore RAT errors and display a log message if any. Its use is NOT
* RECOMMENDED, but quite convenient on occasion.
*
* @since 0.9
@@ -227,7 +227,7 @@ public class RatCheckMojo extends AbstractRatMojo {
}
/**
- * Reads the location of the rat text file from the Mojo.
+ * Reads the location of the RAT text file from the Mojo.
*
* @return Value of the "reportFile" property.
* @throws MojoFailureException If no output file was specified.
diff --git
a/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
b/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
index 0690c1ce..340432d0 100644
--- a/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
+++ b/apache-rat-plugin/src/test/java/org/apache/rat/mp/RatCheckMojoTest.java
@@ -72,7 +72,7 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
AbstractRatMojo mojo = (AbstractRatMojo) lookupConfiguredMojo(testPom,
pGoal);
assertNotNull(mojo);
- assertNotNull("The mojo is missing its MavenProject, which will result
in an NPE during rat runs.",
+ assertNotNull("The mojo is missing its MavenProject, which will result
in an NPE during RAT runs.",
mojo.getProject());
if (mojo instanceof RatReportMojo) {
@@ -102,12 +102,12 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
final String[] expected = {
ReporterTestUtils.documentOut(true, Document.Type.STANDARD,
"/pom.xml") +
ReporterTestUtils.APACHE_LICENSE,
- ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 1),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.UNKNOWN,
0),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 1, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.UNKNOWN,
0, false),
ReporterTestUtils.apacheLicenseVersion2(1)
};
@@ -128,12 +128,12 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
final RatCheckMojo mojo = newRatCheckMojo("it2");
final File ratTxtFile = mojo.getRatTxtFile();
final String[] expected = {
- "^Files with unapproved licenses:\\s+\\Q/src.txt\\E\\s+",
- ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 2),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0),
+ "^Files with unapproved
licenses\\s+\\*+\\s+\\Q/src.txt\\E\\s+",
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 2, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0, false),
ReporterTestUtils.apacheLicenseVersion2(1),
ReporterTestUtils.unknownLicense(1),
ReporterTestUtils.documentOut(false, Document.Type.STANDARD,
"/src.txt") +
@@ -158,12 +158,13 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
public void testIt3() throws Exception {
final RatCheckMojo mojo = (RatCheckMojo) newRatMojo("it3", "check",
true);
final File ratTxtFile = mojo.getRatTxtFile();
- final String[] expected = { "^Files with unapproved
licenses:\\s+\\Q/src.apt\\E\\s+",
- ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 2),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0),
+ final String[] expected = {
+ "^Files with unapproved
licenses\\s+\\*+\\s+\\Q/src.apt\\E\\s+",
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 2, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0, false),
ReporterTestUtils.apacheLicenseVersion2(1),
ReporterTestUtils.unknownLicense(1),
ReporterTestUtils.documentOut(false, Document.Type.STANDARD,
"/src.apt") +
@@ -187,11 +188,11 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
final RatCheckMojo mojo = (RatCheckMojo) newRatMojo("it5", "check",
true);
final File ratTxtFile = mojo.getRatTxtFile();
final String[] expected = {
- ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 1),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 0, true),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 1, false),
};
final String[] notExpected = {
"^Apache License Version 2.0: ",
@@ -233,11 +234,11 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
ReporterTestUtils.APACHE_LICENSE +
ReporterTestUtils.licenseOut("BSD", "BSD") +
ReporterTestUtils.licenseOut("CC BY", "Creative
Commons Attribution (Unapproved)"),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 1),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 1, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0, false),
ReporterTestUtils.apacheLicenseVersion2(1),
"^BSD: 1 ",
"^Creative Commons Attribution: 1 ",
@@ -268,12 +269,12 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
final RatCheckMojo mojo = newRatCheckMojo("RAT-335-GitIgnore");
final File ratTxtFile = mojo.getRatTxtFile();
final String[] expected = {
- ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
1),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 6),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.UNKNOWN,
4),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
1, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 6, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.UNKNOWN,
4, false),
ReporterTestUtils.apacheLicenseVersion2(2),
ReporterTestUtils.unknownLicense(4),
ReporterTestUtils.documentOut(true, Document.Type.STANDARD,
"/pom.xml") +
@@ -324,11 +325,11 @@ public class RatCheckMojoTest extends
BetterAbstractMojoTestCase {
File barFile = new File(dir, "bar.md");
assertThat(barFile).exists();
final String[] expected = {
- ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0),
- ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 3),
-
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.NOTICES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.BINARIES,
0, false),
+ ReporterTestUtils.counterText(ClaimStatistic.Counter.ARCHIVES,
0, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.STANDARDS, 3, false),
+
ReporterTestUtils.counterText(ClaimStatistic.Counter.GENERATED, 0, false),
ReporterTestUtils.apacheLicenseVersion2(2),
ReporterTestUtils.unknownLicense(1),
ReporterTestUtils.documentOut(false, Document.Type.STANDARD,
"/bar.md") +
diff --git
a/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
b/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
index 4e8f8018..3acabd07 100644
--- a/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
+++ b/apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java
@@ -78,7 +78,7 @@ public class ReportTest extends AbstractRatAntTaskTest {
}
private String logLine(boolean approved, String fileText, String id) {
- return String.format( "%sS \\Q%s\\E\\s+\\Q%s\\E ", approved?" ":"!",
fileText, id);
+ return String.format( "%s \\Q%s\\E\\s+S .*\\s+\\Q%s\\E ", approved?"
":"!", fileText, id);
}
@Test
@@ -90,7 +90,7 @@ public class ReportTest extends AbstractRatAntTaskTest {
@Test
public void testWithReportSentToFile() throws Exception {
final File reportFile = new File(getTempDir(), "selftest.report");
- final String alLine = " S \\Q" + documentName.localized("/") + "\\E";
+ final String alLine = String.format("\\Q%s\\E\\s+S ",
documentName.localized("/"));
if (!getTempDir().mkdirs() && !getTempDir().isDirectory()) {
throw new IOException("Could not create temporary directory " +
getTempDir());
diff --git
a/apache-rat-tasks/src/test/resources/antunit/report-normal-operation.xml
b/apache-rat-tasks/src/test/resources/antunit/report-normal-operation.xml
index 10cfd859..8cbea17e 100644
--- a/apache-rat-tasks/src/test/resources/antunit/report-normal-operation.xml
+++ b/apache-rat-tasks/src/test/resources/antunit/report-normal-operation.xml
@@ -73,7 +73,6 @@ SPDX-License-Identifier: Apache-2.0
<pathelement location="${ant.file}" />
</path>
</pathconvert>
- <property name="expectedOutput" value=" S
/report-normal-operation.xml" />
<property name="expectedOutputXML"
value='<resource encoding="ISO-8859-1"
mediaType="application/xml" name="/report-normal-operation.xml"
type="STANDARD"' />
<property name="expectedOutputXML2" value='family="AL "' />
@@ -106,9 +105,7 @@ SPDX-License-Identifier: Apache-2.0
<file file="${ant.file}" />
</rat:report>
<copy overwrite="true" file="${report.file}"
toFile="${reports.dir}/TEST-testwithReportSentToFile.out"/>
- <au:assertLogDoesntContain text="!S
/report-normal-operation.xml" />
<au:assertFileExists file="${report.file}" />
- <assertReportContains text=" S
/report-normal-operation.xml" />
</target>
<target name="testXMLReportSentToFile" depends="fileReportTest">
@@ -116,8 +113,6 @@ SPDX-License-Identifier: Apache-2.0
<file file="${ant.file}" />
</rat:report>
<copy overwrite="true" file="${report.file}.xml"
toFile="${reports.dir}/TEST-testXMLReportSentToFile.xml"/>
- <au:assertLogDoesntContain text="${expectedOutputXML}"
/>
- <au:assertLogDoesntContain text="${expectedOutputXML2}"
/>
<au:assertFileExists file="${report.file}.xml" />
<assertReportContains text="${expectedOutputXML}"
file="${report.file}.xml" />
@@ -152,8 +147,6 @@ SPDX-License-Identifier: Apache-2.0
</rat:license>
</rat:report>
<copy overwrite="true" file="${report.file}"
toFile="${reports.dir}/TEST-testWithALUnknownSentToFile.out"/>
- <au:assertLogDoesntContain text=" S
/report-normal-operation.xml" />
- <au:assertLogDoesntContain text="!S
/report-normal-operation.xml" />
<assertReportContains text="${UNKNOWN}" />
</target>
@@ -325,8 +318,6 @@ SPDX-License-Identifier: Apache-2.0
</rat:license>
</rat:report>
<copy overwrite="true" file="${report.file}"
toFile="${reports.dir}/TEST-testLicenseNotApprovedSentToFile.out"/>
- <assertReportContains text="!S
/report-normal-operation.xml" />
- <assertReportDoesntContain text=" S
/report-normal-operation.xml" />
<assertReportContains text="${YASL}" />
</target>
@@ -344,7 +335,6 @@ SPDX-License-Identifier: Apache-2.0
</rat:license>
</rat:report>
<copy overwrite="true" file="${report.file}"
toFile="${reports.dir}/TEST-testLicenseApprovedSentToFile.out"/>
- <assertReportContains text=" S
/report-normal-operation.xml" />
<assertReportDoesntContain text="!S
/report-normal-operation.xml" />
<assertReportContains text="${YASL}" />
</target>
@@ -363,8 +353,6 @@ SPDX-License-Identifier: Apache-2.0
</rat:license>
</rat:report>
<copy overwrite="true" file="${report.file}"
toFile="${reports.dir}/TEST-testNoLicenseMatchSentToFile.out"/>
- <assertReportContains text="!S
/report-normal-operation.xml" />
- <assertReportDoesntContain text=" S
/report-normal-operation.xml" />
<assertReportContains text="${UNKNOWN}" />
</target>
@@ -382,8 +370,6 @@ SPDX-License-Identifier: Apache-2.0
${test.version}</rat:text>
</rat:license>
</rat:report>
- <assertReportContains text=" S
/report-normal-operation.xml" />
- <assertReportDoesntContain text="!S
$/report-normal-operation.xml" />
<assertReportContains text="${YASL}" />
</target>
diff --git a/apache-rat-tools/pom.xml b/apache-rat-tools/pom.xml
index 8ae90987..9c87cae2 100644
--- a/apache-rat-tools/pom.xml
+++ b/apache-rat-tools/pom.xml
@@ -53,7 +53,6 @@
<excludes>
<!-- This file is included into a generated file. -->
<exclude>src/main/resources/Args.tpl</exclude>
- <exclude>src/main/resources/ant/report.tpl</exclude>
<!-- These files have bad license headers because they are used
to test bad license headers -->
<exclude>src/test/resources/**</exclude>
</excludes>
diff --git a/apache-rat-tools/src/main/resources/Ant.tpl
b/apache-rat-tools/src/main/resources/Ant.tpl
index ed39f6a2..09a5ff92 100644
--- a/apache-rat-tools/src/main/resources/Ant.tpl
+++ b/apache-rat-tools/src/main/resources/Ant.tpl
@@ -38,7 +38,7 @@ import java.util.Objects;
import java.util.stream.Collectors;
/**
- * Generated class to provide Ant support for standard Rat command line
options.
+ * Generated class to provide Ant support for standard RAT command line
options.
*
* DO NOT EDIT - GENERATED FILE
*/
diff --git a/apache-rat-tools/src/main/resources/Maven.tpl
b/apache-rat-tools/src/main/resources/Maven.tpl
index 269601b7..f4640f9b 100644
--- a/apache-rat-tools/src/main/resources/Maven.tpl
+++ b/apache-rat-tools/src/main/resources/Maven.tpl
@@ -40,7 +40,7 @@ import java.util.stream.Collectors;
/* DO NOT EDIT - GENERATED FILE */
/**
- * Generated class to provide Maven support for standard Rat command line
options
+ * Generated class to provide Maven support for standard RAT command line
options
*/
${class}
@@ -84,7 +84,6 @@ ${commonArgs}
${constructor}
-
/* GENERATED METHODS */
diff --git a/apache-rat-tools/src/main/resources/ant/report.tpl
b/apache-rat-tools/src/main/resources/ant/report.tpl
deleted file mode 100644
index 7c928fe1..00000000
--- a/apache-rat-tools/src/main/resources/ant/report.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-
- The Report task is the heart of the Apache Rat Ant Task Library, it
- runs Rat on a given set of resources and generates the report.
-
- The task can work on any Ant
- {{{https://ant.apache.org/manual/Types/resources.html}resource or
- resource collection}} and the usual Ant selectors can be applied to
- restrict things even further.
-
- Reports can use Rat's internal XML or plain text format or be styled
- by a custom XSLT stylesheet.
-
- It is possible to define custom matchers for licenses not directly supported
- by Rat via nested elements to the Report task.
diff --git a/apache-rat/README-ANT.txt b/apache-rat/README-ANT.txt
index 658c7bc6..0effdc95 100644
--- a/apache-rat/README-ANT.txt
+++ b/apache-rat/README-ANT.txt
@@ -59,4 +59,4 @@ There are several ways to use the Antlib:
xmlns:rat="antlib:org.apache.rat.anttasks"
xmlns="antlib:org.apache.tools.ant">
- All tasks of this library will automatically be available in the rat
namespace without any taskdef.
+ All tasks of this library will automatically be available in the "rat"
namespace without any taskdef.
diff --git a/apache-rat/src/site/apt/index.apt.vm
b/apache-rat/src/site/apt/index.apt.vm
index 5cad7f57..8028fec6 100644
--- a/apache-rat/src/site/apt/index.apt.vm
+++ b/apache-rat/src/site/apt/index.apt.vm
@@ -79,7 +79,7 @@ java -jar apache-rat/target/apache-rat-${project.version}.jar
** Styling output
- Rat allows you to style the output as you see fit. Three stylesheets are
included in the rat package.
+ RAT allows you to style the output as you see fit. Three stylesheets are
included in the "rat" package.
*
{{{https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl}plain-rat}}
- The default stylesheet.
diff --git a/apache-rat/src/site/apt/output/example.apt
b/apache-rat/src/site/apt/output/example.apt
index cb321227..cb34b703 100644
--- a/apache-rat/src/site/apt/output/example.apt
+++ b/apache-rat/src/site/apt/output/example.apt
@@ -28,82 +28,136 @@ Default Output Example
+------------------------------------------+
*****************************************************
Summary
--------
-Generated at: 2024-03-30T14:40:39+01:00
-
-Notes: 2
-Binaries: 2
-Archives: 1
-Standards: 8
-
-Apache Licensed: 5
-Generated Documents: 1
+*****************************************************
+Generated at: 2024-11-28T08:03:52Z
+ by Apache Creadur RAT 0.17 (Apache Software Foundation)
+
+-----------------------------------------------------
+Counters
+-----------------------------------------------------
+ (Entries starting with '!' exceed the minimum or maximum values)
+ Approved: 9 A count of approved licenses.
+ Archives: 1 A count of archive files.
+ Binaries: 2 A count of binary files.
+ Document types: 5 A count of distinct document types.
+ Generated: 1 A count of generated files.
+ License categories: 5 A count of distinct license categories.
+ License names: 6 A count of distinct license names.
+ Notices: 2 A count of notice files.
+ Standards: 8 A count of standard files.
+! Unapproved: 2 A count of unapproved licenses.
+ Unknown: 2 A count of unknown file types.
+
+
+-----------------------------------------------------
+Licenses detected
+-----------------------------------------------------
+
+Apache License Version 2.0: 5
+BSD 3 clause: 1
+Generated Files: 1
+The MIT License: 1
+The Telemanagement Forum License: 1
+Unknown license: 2
+
+-----------------------------------------------------
+License Categories detected
+-----------------------------------------------------
+
+?????: 2
+AL : 5
+BSD-3: 2
+GEN : 1
+MIT : 1
+
+-----------------------------------------------------
+Document Types detected
+-----------------------------------------------------
+
+ARCHIVE: 1
+BINARY: 2
+GENERATED: 1
+NOTICE: 2
+STANDARD: 8
-JavaDocs are generated, thus a license header is optional.
-Generated files do not require license headers.
+*****************************************************
+Files with unapproved licenses
+*****************************************************
-2 Unknown Licenses
+ /Source.java
+ /sub/Empty.txt
+*****************************************************
+Archives
*****************************************************
-Files with unapproved licenses:
-
- src/test/resources/elements/Source.java
- src/test/resources/elements/sub/Empty.txt
+ /dummy.jar
*****************************************************
-
+Detail
*****************************************************
- Documents with unapproved licenses will start with a '!'
+
+ The line following documents with unapproved licenses will start with a '!'
The next character identifies the document type.
char type
- a Archive file
- b Binary file
- g Generated file
- n Notice file
- s Standard file
- u Unknown file.
-
- s src/test/resources/elements/ILoggerFactory.java
+ A Archive file
+ B Binary file
+ G Generated file
+ N Notice file
+ S Standard file
+ U Unknown file.
+
+/ILoggerFactory.java
+ S text/x-java-source ISO-8859-1
MIT MIT The MIT License
- b src/test/resources/elements/Image.png
+/Image.png
+ B image/png
- n src/test/resources/elements/LICENSE
+/LICENSE
+ N text/plain
- n src/test/resources/elements/NOTICE
+/NOTICE
+ N text/plain
-!s src/test/resources/elements/Source.java
+/Source.java
+ !S text/x-java-source ISO-8859-1
????? ????? Unknown license (Unapproved)
- s src/test/resources/elements/Text.txt
+/Text.txt
+ S text/plain ISO-8859-1
AL AL Apache License Version 2.0
- s src/test/resources/elements/TextHttps.txt
+/TextHttps.txt
+ S text/plain ISO-8859-1
AL AL Apache License Version 2.0
- s src/test/resources/elements/Xml.xml
+/Xml.xml
+ S application/xml ISO-8859-1
AL AL Apache License Version 2.0
- s src/test/resources/elements/buildr.rb
+/buildr.rb
+ S text/x-ruby ISO-8859-1
AL AL Apache License Version 2.0
- a src/test/resources/elements/dummy.jar
+/dummy.jar
+ A application/java-archive
- g src/test/resources/elements/generated.txt
+/generated.txt
+ G text/plain
GEN GEN Generated Files
- b src/test/resources/elements/plain.json
+/plain.json
+ B application/json
+
+/sub/Empty.txt
+ !S text/plain UTF-8
+ ????? ????? Unknown license (Unapproved)
- s src/test/resources/elements/tri.txt
+/tri.txt
+ S text/plain ISO-8859-1
AL AL Apache License Version 2.0
BSD-3 BSD-3 BSD 3 clause
BSD-3 TMF The Telemanagement Forum License
-
-!s src/test/resources/elements/sub/Empty.txt
- ????? ????? Unknown license (Unapproved)
-
-
-*****************************************************
+------------------------------------------+
diff --git a/apache-rat/src/site/examples/default_output.txt
b/apache-rat/src/site/examples/default_output.txt
index 5caee8cf..eb3e5d5d 100644
--- a/apache-rat/src/site/examples/default_output.txt
+++ b/apache-rat/src/site/examples/default_output.txt
@@ -1,24 +1,29 @@
*****************************************************
Summary
*****************************************************
-Generated at: 2024-11-09T13:16:50Z
-
-Counters:
-
-Approved: 9 A count of approved licenses.
-Archives: 1 A count of archive files.
-Binaries: 2 A count of binary files.
-Document types: 5 A count of distinct document types.
-Generated: 1 A count of generated files.
-License categories: 5 A count of distinct license categories.
-License names: 6 A count of distinct license names.
-Notices: 2 A count of notice files.
-Standards: 8 A count of standard files.
-Unapproved: 2 (Exceeded limits) A count of unapproved licenses.
-Unknown: 2 A count of unknown file types.
-
-
-Licenses detected:
+Generated at: 2024-11-28T08:03:52Z
+ by Apache Creadur RAT 0.17 (Apache Software Foundation)
+
+-----------------------------------------------------
+Counters
+-----------------------------------------------------
+ (Entries starting with '!' exceed the minimum or maximum values)
+ Approved: 9 A count of approved licenses.
+ Archives: 1 A count of archive files.
+ Binaries: 2 A count of binary files.
+ Document types: 5 A count of distinct document types.
+ Generated: 1 A count of generated files.
+ License categories: 5 A count of distinct license categories.
+ License names: 6 A count of distinct license names.
+ Notices: 2 A count of notice files.
+ Standards: 8 A count of standard files.
+! Unapproved: 2 A count of unapproved licenses.
+ Unknown: 2 A count of unknown file types.
+
+
+-----------------------------------------------------
+Licenses detected
+-----------------------------------------------------
Apache License Version 2.0: 5
BSD 3 clause: 1
@@ -27,7 +32,9 @@ The MIT License: 1
The Telemanagement Forum License: 1
Unknown license: 2
-License Categories detected:
+-----------------------------------------------------
+License Categories detected
+-----------------------------------------------------
?????: 2
AL : 5
@@ -35,7 +42,9 @@ BSD-3: 2
GEN : 1
MIT : 1
-Document Types detected:
+-----------------------------------------------------
+Document Types detected
+-----------------------------------------------------
ARCHIVE: 1
BINARY: 2
@@ -44,19 +53,23 @@ NOTICE: 2
STANDARD: 8
*****************************************************
-
-Files with unapproved licenses:
+Files with unapproved licenses
+*****************************************************
/Source.java
/sub/Empty.txt
+*****************************************************
+Archives
*****************************************************
-Archives:
/dummy.jar
*****************************************************
- Documents with unapproved licenses will start with a '!'
+Detail
+*****************************************************
+
+ The line following documents with unapproved licenses will start with a '!'
The next character identifies the document type.
char type
@@ -67,30 +80,55 @@ Archives:
S Standard file
U Unknown file.
-
- S /ILoggerFactory.java
+/ILoggerFactory.java
+ S text/x-java-source ISO-8859-1
MIT MIT The MIT License
- B /Image.png
- N /LICENSE
- N /NOTICE
-!S /Source.java
+
+/Image.png
+ B image/png
+
+/LICENSE
+ N text/plain
+
+/NOTICE
+ N text/plain
+
+/Source.java
+ !S text/x-java-source ISO-8859-1
????? ????? Unknown license (Unapproved)
- S /Text.txt
+
+/Text.txt
+ S text/plain ISO-8859-1
AL AL Apache License Version 2.0
- S /TextHttps.txt
+
+/TextHttps.txt
+ S text/plain ISO-8859-1
AL AL Apache License Version 2.0
- S /Xml.xml
+
+/Xml.xml
+ S application/xml ISO-8859-1
AL AL Apache License Version 2.0
- S /buildr.rb
+
+/buildr.rb
+ S text/x-ruby ISO-8859-1
AL AL Apache License Version 2.0
- A /dummy.jar
- G /generated.txt
+
+/dummy.jar
+ A application/java-archive
+
+/generated.txt
+ G text/plain
GEN GEN Generated Files
- B /plain.json
-!S /sub/Empty.txt
+
+/plain.json
+ B application/json
+
+/sub/Empty.txt
+ !S text/plain UTF-8
????? ????? Unknown license (Unapproved)
- S /tri.txt
+
+/tri.txt
+ S text/plain ISO-8859-1
AL AL Apache License Version 2.0
BSD-3 BSD-3 BSD 3 clause
BSD-3 TMF The Telemanagement Forum License
-*****************************************************
diff --git a/apache-rat/src/site/examples/rat-report.txt
b/apache-rat/src/site/examples/rat-report.txt
index 71394bb0..8fc5431a 100644
--- a/apache-rat/src/site/examples/rat-report.txt
+++ b/apache-rat/src/site/examples/rat-report.txt
@@ -1,17 +1,14 @@
-<rat-report timestamp="2024-11-09T13:58:50Z">
- <version product="TITLE" vendor="VENDOR-NAME" version="VERSION-NUMBER"/>
- <resource name="/ILoggerFactory.java" type="STANDARD">
- <license approval="true" family="MIT " id="MIT" name="The MIT License"/>
- </resource>
- <resource name="/Image.png" type="BINARY"/>
- <resource name="/LICENSE" type="NOTICE"/>
- <resource name="/NOTICE" type="NOTICE"/>
- <resource name="/Source.java" type="STANDARD">
- <license approval="false"
- family="?????"
- id="?????"
- name="Unknown license"/>
- <sample> package elements;
+<rat-report timestamp="2024-11-28T08:12:35Z">
+ <version product="Apache Creadur RAT" vendor="Apache Software Foundation"
version="0.17"/>
+ <resource encoding="ISO-8859-1" mediaType="text/x-java-source"
name="/ILoggerFactory.java" type="STANDARD">
+ <license approval="true" family="MIT " id="MIT" name="The MIT
License"/>
+ </resource>
+ <resource mediaType="image/png" name="/Image.png" type="BINARY"/>
+ <resource mediaType="text/plain" name="/LICENSE" type="NOTICE"/>
+ <resource mediaType="text/plain" name="/NOTICE" type="NOTICE"/>
+ <resource encoding="ISO-8859-1" mediaType="text/x-java-source"
name="/Source.java" type="STANDARD">
+ <license approval="false" family="?????" id="?????" name="Unknown
license"/>
+ <sample> package elements;
/*
* This file does intentionally *NOT* contain an AL license header,
@@ -21,116 +18,62 @@ public class Source {
}
</sample>
- </resource>
- <resource name="/Text.txt" type="STANDARD">
- <license approval="true"
- family="AL "
- id="AL"
- name="Apache License Version 2.0"/>
- </resource>
- <resource name="/TextHttps.txt" type="STANDARD">
- <license approval="true"
- family="AL "
- id="AL"
- name="Apache License Version 2.0"/>
- </resource>
- <resource name="/Xml.xml" type="STANDARD">
- <license approval="true"
- family="AL "
- id="AL"
- name="Apache License Version 2.0"/>
- </resource>
- <resource name="/buildr.rb" type="STANDARD">
- <license approval="true"
- family="AL "
- id="AL"
- name="Apache License Version 2.0"/>
- </resource>
- <resource name="/dummy.jar" type="ARCHIVE"/>
- <resource name="/generated.txt" type="GENERATED">
- <license approval="true" family="GEN " id="GEN" name="Generated Files">
- <notes>
+ </resource>
+ <resource encoding="ISO-8859-1" mediaType="text/plain" name="/Text.txt"
type="STANDARD">
+ <license approval="true" family="AL " id="AL" name="Apache License
Version 2.0"/>
+ </resource>
+ <resource encoding="ISO-8859-1" mediaType="text/plain"
name="/TextHttps.txt" type="STANDARD">
+ <license approval="true" family="AL " id="AL" name="Apache License
Version 2.0"/>
+ </resource>
+ <resource encoding="ISO-8859-1" mediaType="application/xml"
name="/Xml.xml" type="STANDARD">
+ <license approval="true" family="AL " id="AL" name="Apache License
Version 2.0"/>
+ </resource>
+ <resource encoding="ISO-8859-1" mediaType="text/x-ruby" name="/buildr.rb"
type="STANDARD">
+ <license approval="true" family="AL " id="AL" name="Apache License
Version 2.0"/>
+ </resource>
+ <resource mediaType="application/java-archive" name="/dummy.jar"
type="ARCHIVE"/>
+ <resource mediaType="text/plain" name="/generated.txt" type="GENERATED">
+ <license approval="true" family="GEN " id="GEN" name="Generated
Files">
+ <notes>
Files that are automatically generated. </notes>
- </license>
- </resource>
- <resource name="/plain.json" type="BINARY"/>
- <resource name="/sub/Empty.txt" type="STANDARD">
- <license approval="false"
- family="?????"
- id="?????"
- name="Unknown license"/>
- </resource>
- <resource name="/tri.txt" type="STANDARD">
- <license approval="true"
- family="AL "
- id="AL"
- name="Apache License Version 2.0"/>
- <license approval="true" family="BSD-3" id="BSD-3" name="BSD 3 clause"/>
- <license approval="true"
- family="BSD-3"
- id="TMF"
- name="The Telemanagement Forum License"/>
- </resource>
- <statistics>
- <statistic approval="true"
- count="9"
- description="A count of approved licenses."
- name="Approved"/>
- <statistic approval="true"
- count="1"
- description="A count of archive files."
- name="Archives"/>
- <statistic approval="true"
- count="2"
- description="A count of binary files."
- name="Binaries"/>
- <statistic approval="true"
- count="5"
- description="A count of distinct document types."
- name="Document types"/>
- <statistic approval="true"
- count="1"
- description="A count of generated files."
- name="Generated"/>
- <statistic approval="true"
- count="5"
- description="A count of distinct license categories."
- name="License categories"/>
- <statistic approval="true"
- count="6"
- description="A count of distinct license names."
- name="License names"/>
- <statistic approval="true"
- count="2"
- description="A count of notice files."
- name="Notices"/>
- <statistic approval="true"
- count="8"
- description="A count of standard files."
- name="Standards"/>
- <statistic approval="false"
- count="2"
- description="A count of unapproved licenses."
- name="Unapproved"/>
- <statistic approval="true"
- count="2"
- description="A count of unknown file types."
- name="Unknown"/>
- <licenseCategory count="2" name="?????"/>
- <licenseCategory count="5" name="AL "/>
- <licenseCategory count="2" name="BSD-3"/>
- <licenseCategory count="1" name="GEN "/>
- <licenseCategory count="1" name="MIT "/>
- <licenseName count="5" name="Apache License Version 2.0"/>
- <licenseName count="1" name="BSD 3 clause"/>
- <licenseName count="1" name="Generated Files"/>
- <licenseName count="1" name="The MIT License"/>
- <licenseName count="1" name="The Telemanagement Forum License"/>
- <licenseName count="2" name="Unknown license"/>
- <documentType count="1" name="ARCHIVE"/>
- <documentType count="2" name="BINARY"/>
- <documentType count="1" name="GENERATED"/>
- <documentType count="2" name="NOTICE"/>
- <documentType count="8" name="STANDARD"/>
- </statistics>
+ </license>
+ </resource>
+ <resource mediaType="application/json" name="/plain.json" type="BINARY"/>
+ <resource encoding="UTF-8" mediaType="text/plain" name="/sub/Empty.txt"
type="STANDARD">
+ <license approval="false" family="?????" id="?????" name="Unknown
license"/>
+ </resource>
+ <resource encoding="ISO-8859-1" mediaType="text/plain" name="/tri.txt"
type="STANDARD">
+ <license approval="true" family="AL " id="AL" name="Apache License
Version 2.0"/>
+ <license approval="true" family="BSD-3" id="BSD-3" name="BSD 3
clause"/>
+ <license approval="true" family="BSD-3" id="TMF" name="The
Telemanagement Forum License"/>
+ </resource>
+ <statistics>
+ <statistic approval="true" count="9" description="A count of approved
licenses." name="Approved"/>
+ <statistic approval="true" count="1" description="A count of archive
files." name="Archives"/>
+ <statistic approval="true" count="2" description="A count of binary
files." name="Binaries"/>
+ <statistic approval="true" count="5" description="A count of distinct
document types." name="Document types"/>
+ <statistic approval="true" count="1" description="A count of generated
files." name="Generated"/>
+ <statistic approval="true" count="5" description="A count of distinct
license categories." name="License categories"/>
+ <statistic approval="true" count="6" description="A count of distinct
license names." name="License names"/>
+ <statistic approval="true" count="2" description="A count of notice
files." name="Notices"/>
+ <statistic approval="true" count="8" description="A count of standard
files." name="Standards"/>
+ <statistic approval="false" count="2" description="A count of
unapproved licenses." name="Unapproved"/>
+ <statistic approval="true" count="2" description="A count of unknown
file types." name="Unknown"/>
+ <licenseCategory count="2" name="?????"/>
+ <licenseCategory count="5" name="AL "/>
+ <licenseCategory count="2" name="BSD-3"/>
+ <licenseCategory count="1" name="GEN "/>
+ <licenseCategory count="1" name="MIT "/>
+ <licenseName count="5" name="Apache License Version 2.0"/>
+ <licenseName count="1" name="BSD 3 clause"/>
+ <licenseName count="1" name="Generated Files"/>
+ <licenseName count="1" name="The MIT License"/>
+ <licenseName count="1" name="The Telemanagement Forum License"/>
+ <licenseName count="2" name="Unknown license"/>
+ <documentType count="1" name="ARCHIVE"/>
+ <documentType count="2" name="BINARY"/>
+ <documentType count="1" name="GENERATED"/>
+ <documentType count="2" name="NOTICE"/>
+ <documentType count="8" name="STANDARD"/>
+ </statistics>
</rat-report>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 48472b3a..aec8db8f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -72,6 +72,9 @@ The <action> type attribute can be one of:
</release>
-->
<release version="0.17-SNAPSHOT" date="xxxx-yy-zz" description="Current
SNAPSHOT - release to be done">
+ <action issue="RAT-453" type="add" dev="claudenw">
+ Change layout and rendering of RAT report to contain RAT version
information, counter values, encoding information of scanned files and
aggregation by license type.
+ </action>
<action issue="RAT-178" type="add" dev="claudenw">
Added tests to TikaProcessorTests and DefaultAnalyserFactoryTest to
properly handle non-existent and unreadable files during processing runs of our
BinaryGuesser.
</action>
diff --git a/src/python/recursive-rat.py b/src/python/recursive-rat.py
index 8faee918..b386becb 100644
--- a/src/python/recursive-rat.py
+++ b/src/python/recursive-rat.py
@@ -158,10 +158,10 @@ def walkDirectories(base, ratCommand, gpgCommand,
baseReportDir = None, f=lambda
walk(base, lambda dummy, dir, files: f(ratCommand, gpgCommand, dir, files,
baseReportDir), None)
def enterRatCommand(rat = None):
- '''If necessary, prompts user for an acceptable Rat command'''
+ '''If necessary, prompts user for an acceptable RAT command'''
if rat == None:
try:
- rat = raw_input("Please enter Rat command (including path): ")
+ rat = raw_input("Please enter RAT command (including path): ")
except EOFError:
raise UserAbortError()
diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm
index 4ba90587..1614332f 100644
--- a/src/site/apt/index.apt.vm
+++ b/src/site/apt/index.apt.vm
@@ -126,7 +126,7 @@ java -jar apache-rat-${project.version}.jar [options]
[Directory or Archive]
** Styling output
- Rat allows you to style the output as you see fit. Three stylesheets are
included in the rat package.
+ RAT allows you to style the output as you see fit. Three stylesheets are
included in the "rat" package.
*
{{{https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl}plain-rat}}
- The default stylesheet.