diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index 79ee123..d91f848 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -1,5 +1,5 @@ - \ No newline at end of file diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index 3409629..a71dcdf 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -2,11 +2,11 @@ - + - + diff --git a/.vscode/settings.json b/.vscode/settings.json index 122fc60..3ca51df 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.rife2/dist/rife2-1.5.20.jar", + "${HOME}/.rife2/dist/rife2-1.5.22.jar", "lib/compile/*.jar", "lib/runtime/*.jar", "lib/test/*.jar" diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar index 2c3f5a5..6e95b95 100644 Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 711e55e..d3de463 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -3,4 +3,4 @@ bld.downloadExtensionSources=true bld.extensions= bld.repositories=MAVEN_CENTRAL,RIFE2 rife2.downloadLocation= -rife2.version=1.5.20 +rife2.version=1.5.22 diff --git a/src/bld/java/rife/bld/extension/PmdOperationBuild.java b/src/bld/java/rife/bld/extension/PmdOperationBuild.java index 34e50ba..184dd68 100644 --- a/src/bld/java/rife/bld/extension/PmdOperationBuild.java +++ b/src/bld/java/rife/bld/extension/PmdOperationBuild.java @@ -7,8 +7,11 @@ import rife.bld.publish.PublishScm; import java.util.List; -import static rife.bld.dependencies.Repository.*; -import static rife.bld.dependencies.Scope.*; +import static rife.bld.dependencies.Repository.MAVEN_CENTRAL; +import static rife.bld.dependencies.Repository.RIFE2_RELEASES; +import static rife.bld.dependencies.Scope.compile; +import static rife.bld.dependencies.Scope.runtime; +import static rife.bld.dependencies.Scope.test; import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; @@ -23,11 +26,12 @@ public class PmdOperationBuild extends Project { autoDownloadPurge = true; repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); + var pmd = version(7, 0, 0, "rc1"); scope(compile) - .include(dependency("com.uwyn.rife2", "rife2", version(1, 5, 20))) - .include(dependency("net.sourceforge.pmd:pmd-java:6.55.0")); + .include(dependency("com.uwyn.rife2", "rife2", version(1, 5, 22))) + .include(dependency("net.sourceforge.pmd", "pmd-java", pmd)); scope(runtime) - .include(dependency("net.sourceforge.pmd:pmd:6.55.0")); + .include(dependency("net.sourceforge.pmd", "pmd-java", pmd)); scope(test) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 2))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 2))) diff --git a/src/main/java/rife/bld/extension/PmdOperation.java b/src/main/java/rife/bld/extension/PmdOperation.java index 80e5978..451b759 100644 --- a/src/main/java/rife/bld/extension/PmdOperation.java +++ b/src/main/java/rife/bld/extension/PmdOperation.java @@ -353,7 +353,8 @@ public class PmdOperation extends AbstractOperation { var pmd = PmdAnalysis.create(config); var report = pmd.performAnalysisAndCollectReport(); if (LOGGER.isLoggable(Level.INFO)) { - LOGGER.info(String.format("[%s] ruleSets%s", commandName, ruleSets)); + LOGGER.log(Level.INFO, "[{0}] inputPaths{1}", new Object[]{commandName, inputPaths}); + LOGGER.log(Level.INFO, "[{0}] ruleSets{1}", new Object[]{commandName, ruleSets}); } var numErrors = report.getViolations().size(); if (numErrors > 0) { @@ -362,11 +363,11 @@ public class PmdOperation extends AbstractOperation { config.getReportFilePath().toUri()); for (var v : report.getViolations()) { if (LOGGER.isLoggable(Level.WARNING)) { - LOGGER.warning(String.format("[%s] %s:%d:\n\t%s (%s)\n\t\t--> %s", commandName, - Paths.get(v.getFilename()).toUri(), v.getBeginLine(), v.getRule().getName(), - v.getRule().getExternalInfoUrl() //TODO bug in PMD? - .replace("${pmd.website.baseurl}", "https://docs.pmd-code.org/pmd-doc-6.55.0"), - v.getDescription())); + LOGGER.log(Level.WARNING, "[{0}] {1}:{2}:\n\t{3} ({4})\n\t\t--> {5}", + new Object[]{commandName, Paths.get(v.getFilename()).toUri(), v.getBeginLine(), + v.getRule().getName(), + v.getRule().getExternalInfoUrl(), + v.getDescription()}); } } if (config.isFailOnViolation()) { diff --git a/src/test/java/rife/bld/extension/PmdOperationTest.java b/src/test/java/rife/bld/extension/PmdOperationTest.java index af81331..e0c9ddd 100644 --- a/src/test/java/rife/bld/extension/PmdOperationTest.java +++ b/src/test/java/rife/bld/extension/PmdOperationTest.java @@ -39,7 +39,7 @@ class PmdOperationTest { static final String CATEGORY_FOO = "category/foo.xml"; static final String CODE_STYLE = "category/java/codestyle.xml"; static final Path CODE_STYLE_SAMPLE = Path.of("src/test/resources/java/CodeStyle.java"); - static final int CODING_STYLE_ERRORS = 16; + static final int CODING_STYLE_ERRORS = 13; static final String COMMAND_NAME = "pmd"; static final String ERROR_PRONE = "category/java/errorprone.xml"; static final int ERROR_PRONE_ERRORS = 8; @@ -59,7 +59,7 @@ class PmdOperationTest { void testAddInputPaths() { var pmd = newPmdOperation().ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE).inputPaths(ERROR_PRONE_SAMPLE) .addInputPath(CODE_STYLE_SAMPLE); - assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(42); + assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(36); } @Test @@ -128,7 +128,7 @@ class PmdOperationTest { .as("code style").isEqualTo(CODING_STYLE_ERRORS); pmd = pmd.addRuleSet(ERROR_PRONE).addInputPath(ERROR_PRONE_SAMPLE); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))) - .as("code style + error prone").isEqualTo(40); + .as("code style + error prone").isEqualTo(34); } @Test @@ -156,7 +156,7 @@ class PmdOperationTest { void testJavaMultiThreading() { var pmd = newPmdOperation().ruleSets("category/java/multithreading.xml") .inputPaths(Path.of("src/test/resources/java/MultiThreading.java")); - assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(4); + assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(3); } @Test @@ -170,7 +170,7 @@ class PmdOperationTest { void testJavaQuickStart() { var pmd = newPmdOperation().ruleSets("rulesets/java/quickstart.xml") .inputPaths(Path.of("src/test/resources/java")); - assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(35); + assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isEqualTo(34); } @Test diff --git a/src/test/resources/ignore-all.txt b/src/test/resources/ignore-all.txt index e1073ef..8dbea85 100644 --- a/src/test/resources/ignore-all.txt +++ b/src/test/resources/ignore-all.txt @@ -1 +1,2 @@ -src/test/resources/java/ \ No newline at end of file +src/main +src/test \ No newline at end of file diff --git a/src/test/resources/java/Security.java b/src/test/resources/java/Security.java index caf0367..2d534ba 100644 --- a/src/test/resources/java/Security.java +++ b/src/test/resources/java/Security.java @@ -16,6 +16,8 @@ package java; +import javax.crypto.spec.SecretKeySpec; + /** * Security class *