diff --git a/pom.xml b/pom.xml
index e6036e8e0..ad1b82d78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -394,8 +394,6 @@
org.apache.maven.plugins
maven-checkstyle-plugin
-
- true
config/checkstyle-header.txt
**/HelpMojo.java,**/SpdxLicenseListData.java
diff --git a/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/CalcFileWriter.java b/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/CalcFileWriter.java
index 5cce59b4f..bfcd86be0 100644
--- a/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/CalcFileWriter.java
+++ b/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/CalcFileWriter.java
@@ -143,6 +143,7 @@ private static Color convertToOdfColor(final int[] color) {
return new Color(color[0], color[1], color[2]);
}
+ @SuppressWarnings("checkstyle:MethodLength")
private static void createHeader(
List projectLicenseInfos, OdfSpreadsheetDocument spreadsheet, OdfTable table) {
boolean hasExtendedInfo = false;
@@ -474,6 +475,7 @@ private static void createHeaderStyle(OdfSpreadsheetDocument spreadsheet) {
Reduce parameters, complicated parameters/DTO pattern.
But keep it still threadsafe.
*/
+ @SuppressWarnings("checkstyle:MethodLength")
private static void writeData(
List projectLicenseInfos,
OdfSpreadsheetDocument wb,
diff --git a/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/ExcelFileWriter.java b/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/ExcelFileWriter.java
index eaba69c72..46f356afa 100644
--- a/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/ExcelFileWriter.java
+++ b/src/main/java/org/codehaus/mojo/license/extended/spreadsheet/ExcelFileWriter.java
@@ -116,6 +116,7 @@ public static void write(List projectLicenseInfos, final Fil
}
}
+ @SuppressWarnings("checkstyle:MethodLength")
private static void createHeader(List projectLicenseInfos, Workbook wb, Sheet sheet) {
boolean hasExtendedInfo = false;
for (ProjectLicenseInfo projectLicenseInfo : projectLicenseInfos) {
@@ -354,6 +355,7 @@ private static void createHeader(List projectLicenseInfos, W
Clean this method up.
Reduce parameters, complicated parameters/DTO pattern.
But keep it still threadsafe. */
+ @SuppressWarnings("checkstyle:MethodLength")
private static void writeData(
List projectLicenseInfos,
XSSFWorkbook wb,
diff --git a/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java b/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java
index e1a41ceb9..59b275c5e 100644
--- a/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java
+++ b/src/test/java/org/codehaus/mojo/license/LicenseMojoUtilsTest.java
@@ -4,7 +4,10 @@
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
public class LicenseMojoUtilsTest {
private String resolvedUrl;
diff --git a/src/test/java/org/codehaus/mojo/license/MockLogger.java b/src/test/java/org/codehaus/mojo/license/MockLogger.java
index 7b7533450..ef6c4c49d 100644
--- a/src/test/java/org/codehaus/mojo/license/MockLogger.java
+++ b/src/test/java/org/codehaus/mojo/license/MockLogger.java
@@ -8,7 +8,7 @@
public class MockLogger implements LoggerFacade {
private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\Q{}\\E");
- private static final String format(String template, Object param) {
+ private static String format(String template, Object param) {
return PLACEHOLDER_PATTERN.matcher(template).replaceFirst(Matcher.quoteReplacement(String.valueOf(param)));
}
diff --git a/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java b/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java
index bea9a9892..3384491b6 100644
--- a/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java
+++ b/src/test/java/org/codehaus/mojo/license/download/LicenseSummaryTest.java
@@ -115,55 +115,49 @@ public void testWriteReadLicenseSummary()
licSummary.add(dep3);
licSummary.add(dep4);
- {
- File licenseSummaryFile = File.createTempFile("licSummary", "tmp");
- LicenseSummaryWriter.writeLicenseSummary(
- licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, true);
-
- assertTrue(licenseSummaryFile.exists());
- FileInputStream fis = new FileInputStream(licenseSummaryFile);
- List list = LicenseSummaryReader.parseLicenseSummary(fis);
- fis.close();
- ProjectLicenseInfo dep = list.get(0);
- Assert.assertEquals("org.test", dep.getGroupId());
- Assert.assertEquals("test1", dep.getArtifactId());
- Assert.assertEquals("1.0", dep.getVersion());
-
- List licenses = dep.getLicenses();
- Assert.assertEquals(1, licenses.size());
- ProjectLicense lic0 = dep.getLicenses().get(0);
- Assert.assertEquals("lgpl", lic0.getName());
- Assert.assertEquals("http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl());
- Assert.assertEquals("lgpl-3.0.txt", lic0.getFile());
- Assert.assertEquals("lgpl version 3.0", lic0.getComments());
-
- validateXml(licenseSummaryFile);
- }
+ File licenseSummaryFile = File.createTempFile("licSummary", "tmp");
+ LicenseSummaryWriter.writeLicenseSummary(licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, true);
- {
- File licenseSummaryFile = File.createTempFile("licSummaryNoVersionNoXsd", "tmp");
- LicenseSummaryWriter.writeLicenseSummary(
- licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, false);
-
- assertTrue(licenseSummaryFile.exists());
- FileInputStream fis = new FileInputStream(licenseSummaryFile);
- List list = LicenseSummaryReader.parseLicenseSummary(fis);
- fis.close();
- ProjectLicenseInfo dep = list.get(0);
- Assert.assertEquals("org.test", dep.getGroupId());
- Assert.assertEquals("test1", dep.getArtifactId());
- Assert.assertNull(dep.getVersion());
-
- List licenses = dep.getLicenses();
- Assert.assertEquals(1, licenses.size());
- ProjectLicense lic0 = dep.getLicenses().get(0);
- Assert.assertEquals("lgpl", lic0.getName());
- Assert.assertEquals("http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl());
- Assert.assertEquals("lgpl-3.0.txt", lic0.getFile());
- Assert.assertEquals("lgpl version 3.0", lic0.getComments());
-
- validateXml(licenseSummaryFile);
- }
+ assertTrue(licenseSummaryFile.exists());
+ FileInputStream fis = new FileInputStream(licenseSummaryFile);
+ List list = LicenseSummaryReader.parseLicenseSummary(fis);
+ fis.close();
+ ProjectLicenseInfo dep = list.get(0);
+ Assert.assertEquals("org.test", dep.getGroupId());
+ Assert.assertEquals("test1", dep.getArtifactId());
+ Assert.assertEquals("1.0", dep.getVersion());
+
+ List licenses = dep.getLicenses();
+ Assert.assertEquals(1, licenses.size());
+ ProjectLicense lic0 = dep.getLicenses().get(0);
+ Assert.assertEquals("lgpl", lic0.getName());
+ Assert.assertEquals("http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl());
+ Assert.assertEquals("lgpl-3.0.txt", lic0.getFile());
+ Assert.assertEquals("lgpl version 3.0", lic0.getComments());
+
+ validateXml(licenseSummaryFile);
+
+ licenseSummaryFile = File.createTempFile("licSummaryNoVersionNoXsd", "tmp");
+ LicenseSummaryWriter.writeLicenseSummary(licSummary, licenseSummaryFile, StandardCharsets.UTF_8, Eol.LF, false);
+
+ assertTrue(licenseSummaryFile.exists());
+ fis = new FileInputStream(licenseSummaryFile);
+ list = LicenseSummaryReader.parseLicenseSummary(fis);
+ fis.close();
+ dep = list.get(0);
+ Assert.assertEquals("org.test", dep.getGroupId());
+ Assert.assertEquals("test1", dep.getArtifactId());
+ Assert.assertNull(dep.getVersion());
+
+ licenses = dep.getLicenses();
+ Assert.assertEquals(1, licenses.size());
+ lic0 = dep.getLicenses().get(0);
+ Assert.assertEquals("lgpl", lic0.getName());
+ Assert.assertEquals("http://www.gnu.org/licenses/lgpl-3.0.txt", lic0.getUrl());
+ Assert.assertEquals("lgpl-3.0.txt", lic0.getFile());
+ Assert.assertEquals("lgpl version 3.0", lic0.getComments());
+
+ validateXml(licenseSummaryFile);
Path licensesExcelOutputFile = Files.createTempFile("licExcel", ".xlsx");
ExcelFileWriter.write(licSummary, licensesExcelOutputFile.toFile());
diff --git a/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java b/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java
index 0d163f972..bb7cc1b0b 100644
--- a/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java
+++ b/src/test/java/org/codehaus/mojo/license/header/transformer/AbstractFileHeaderTransformerTest.java
@@ -32,7 +32,10 @@
import org.junit.Test;
import static org.codehaus.mojo.license.header.transformer.AbstractFileHeaderTransformer.COPYRIGHT_PATTERN;
-import static org.codehaus.mojo.license.header.transformer.FileHeaderTransformer.*;
+import static org.codehaus.mojo.license.header.transformer.FileHeaderTransformer.DEFAULT_PROCESS_END_TAG;
+import static org.codehaus.mojo.license.header.transformer.FileHeaderTransformer.DEFAULT_PROCESS_START_TAG;
+import static org.codehaus.mojo.license.header.transformer.FileHeaderTransformer.DEFAULT_SECTION_DELIMITER;
+import static org.codehaus.mojo.license.header.transformer.FileHeaderTransformer.LINE_SEPARATOR;
/**
* Tests the {@link AbstractFileHeaderTransformer}.
diff --git a/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java b/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java
index 734250130..5b285bb89 100644
--- a/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java
+++ b/src/test/java/org/codehaus/mojo/license/spdx/SpdxLicenseListTest.java
@@ -21,34 +21,25 @@ public void mimeTypes() {
@Test
public void extraAliases() {
- final Map lics = SpdxLicenseList.getLatest().getLicenses();
- {
- final Map urlInfos =
- lics.get("Apache-2.0").getAttachments().getUrlInfos();
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0.php"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0.html"));
- }
- {
- final Map urlInfos =
- lics.get("BSD-2-Clause").getAttachments().getUrlInfos();
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license.php"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license.html"));
- }
- {
- final Map urlInfos =
- lics.get("CDDL-1.0").getAttachments().getUrlInfos();
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1.php"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1.html"));
- }
- {
- final Map urlInfos =
- lics.get("MIT").getAttachments().getUrlInfos();
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license.php"));
- Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license.html"));
- }
+ Map lics = SpdxLicenseList.getLatest().getLicenses();
+ Map urlInfos = lics.get("Apache-2.0").getAttachments().getUrlInfos();
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0.php"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/apache2.0.html"));
+
+ urlInfos = lics.get("BSD-2-Clause").getAttachments().getUrlInfos();
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license.php"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/bsd-license.html"));
+
+ urlInfos = lics.get("CDDL-1.0").getAttachments().getUrlInfos();
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1.php"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/cddl1.html"));
+
+ urlInfos = lics.get("MIT").getAttachments().getUrlInfos();
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license.php"));
+ Assert.assertTrue(urlInfos.containsKey("https://opensource.org/licenses/mit-license.html"));
}
}