diff --git a/src/bld/java/rife/bld/extension/PmdOperationBuild.java b/src/bld/java/rife/bld/extension/PmdOperationBuild.java index cae7dcd..1bb6f66 100644 --- a/src/bld/java/rife/bld/extension/PmdOperationBuild.java +++ b/src/bld/java/rife/bld/extension/PmdOperationBuild.java @@ -34,14 +34,14 @@ public class PmdOperationBuild extends Project { public PmdOperationBuild() { pkg = "rife.bld.extension"; name = "bld-pmd"; - version = version(0, 9, 7); + version = version(0, 9, 8); javaRelease = 17; downloadSources = true; autoDownloadPurge = true; repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); - var pmd = version(7, 0, 0, "rc4"); + var pmd = version(7, 0, 0); scope(compile) .include(dependency("com.uwyn.rife2", "bld", version(1, 9, 0))) .include(dependency("net.sourceforge.pmd", "pmd-java", pmd)); diff --git a/src/main/java/rife/bld/extension/PmdOperation.java b/src/main/java/rife/bld/extension/PmdOperation.java index f55c13e..0d1dae1 100644 --- a/src/main/java/rife/bld/extension/PmdOperation.java +++ b/src/main/java/rife/bld/extension/PmdOperation.java @@ -18,8 +18,8 @@ package rife.bld.extension; import net.sourceforge.pmd.PMDConfiguration; import net.sourceforge.pmd.PmdAnalysis; -import net.sourceforge.pmd.RulePriority; import net.sourceforge.pmd.lang.LanguageVersion; +import net.sourceforge.pmd.lang.rule.RulePriority; import rife.bld.BaseProject; import rife.bld.operations.AbstractOperation; @@ -105,6 +105,10 @@ public class PmdOperation extends AbstractOperation { * The report format. */ String reportFormat_ = "text"; + /** + * The report properties. + */ + Properties reportProperties_ = null; /** * The show suppressed flag. */ @@ -359,6 +363,10 @@ public class PmdOperation extends AbstractOperation { config.setInputPathList(inputPaths_); } + if (reportProperties_ != null) { + config.setReportProperties(reportProperties_); + } + if (inputUri_ != null) { config.setInputUri(inputUri_); } @@ -367,7 +375,8 @@ public class PmdOperation extends AbstractOperation { if (project_ != null) { config.setReportFile(Objects.requireNonNullElseGet(reportFile_, - () -> Paths.get(project_.buildDirectory().getPath(), PMD_DIR, PMD_DIR + "-report." + reportFormat_))); + () -> Paths.get(project_.buildDirectory().getPath(), + PMD_DIR, PMD_DIR + "-report." + reportFormat_))); } else { config.setReportFile(reportFile_); } @@ -430,7 +439,7 @@ public class PmdOperation extends AbstractOperation { v.getRule().getName(), v.getRule().getExternalInfoUrl() //TODO bug in PMD? .replace("${pmd.website.baseurl}", - "https://docs.pmd-code.org/pmd-doc-7.0.0-rc4"), + "https://docs.pmd-code.org/latest"), v.getDescription()}); } } @@ -486,6 +495,14 @@ public class PmdOperation extends AbstractOperation { return this; } + /** + * Set the Report properties. These are used to create the Renderer. + */ + public PmdOperation reportProperties(Properties reportProperties) { + reportProperties_ = reportProperties; + return this; + } + /** * Sets the rule set path(s), disregarding any previously set paths. *

diff --git a/src/test/java/rife/bld/extension/PmdOperationTest.java b/src/test/java/rife/bld/extension/PmdOperationTest.java index c0a0985..9987705 100644 --- a/src/test/java/rife/bld/extension/PmdOperationTest.java +++ b/src/test/java/rife/bld/extension/PmdOperationTest.java @@ -43,7 +43,7 @@ class PmdOperationTest { 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; + static final int ERROR_PRONE_ERRORS = 6; static final Path ERROR_PRONE_SAMPLE = Path.of("src/test/resources/java/ErrorProne.java"); static final String TEST = "test"; @@ -126,7 +126,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(34); + .as("code style + error prone").isEqualTo(29); } @Test