From a02fc618a4007f65b4d3cf516281e1be0ef4ec5c Mon Sep 17 00:00:00 2001 From: William Brockhus <=> Date: Tue, 2 Apr 2024 16:01:49 +1100 Subject: [PATCH 1/4] feat: update PMD to v7 required adjustment of the download url --- download-pmd.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/download-pmd.js b/download-pmd.js index 2aca648..6610398 100644 --- a/download-pmd.js +++ b/download-pmd.js @@ -5,7 +5,7 @@ async function cleanDist() { async function downloadPmd() { const pmdVer = require("./package.json").pmd.version; - const url = `https://github.com/pmd/pmd/releases/download/pmd_releases%2F${pmdVer}/pmd-bin-${pmdVer}.zip`; + const url = `https://github.com/pmd/pmd/releases/download/pmd_releases%2F${pmdVer}/pmd-dist-${pmdVer}-bin.zip`; const response = await fetch(url); return Buffer.from(await response.arrayBuffer(), "binary"); } diff --git a/package.json b/package.json index 181023e..2f7ab58 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "license": "BSD", "main": "pmd", "pmd": { - "version": "6.55.0" + "version": "7.0.0" }, "repository": { "type": "git", From 54210ad1e68754579277ccc966e7b91749f73fa8 Mon Sep 17 00:00:00 2001 From: William Brockhus <=> Date: Tue, 2 Apr 2024 16:53:33 +1100 Subject: [PATCH 2/4] fix: call using updated className --- pmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd b/pmd index 9abd783..32fab79 100755 --- a/pmd +++ b/pmd @@ -4,7 +4,7 @@ const path = require("path"); const jre = require("node-java-connector"); async function main() { - const className = "net.sourceforge.pmd.PMD"; + const className = "net.sourceforge.pmd.cli.PmdCli"; const classPath = [ path.resolve(__dirname, "dist", "pmd-bin", "lib", "*"), ]; From 9c98266cadb709ed2cbc1a0f0fcaa36d6be82ac3 Mon Sep 17 00:00:00 2001 From: William Brockhus <=> Date: Tue, 2 Apr 2024 16:53:41 +1100 Subject: [PATCH 3/4] fix: update tests --- fixtures/valid/Foo.cls | 3 +++ test.sh | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fixtures/valid/Foo.cls b/fixtures/valid/Foo.cls index bd2efcb..3d3afcd 100644 --- a/fixtures/valid/Foo.cls +++ b/fixtures/valid/Foo.cls @@ -1,3 +1,6 @@ +/** + * @description this is a valid apexdoc comment + */ public class Foo { public static final Integer MY_NUM = 0; public String myTest = ''; diff --git a/test.sh b/test.sh index 0dd6ea8..c4a4a62 100644 --- a/test.sh +++ b/test.sh @@ -7,18 +7,18 @@ set -eo errexit ret=0; echo -n "it should succeed linting valid apex code... " -if ! pmd -dir ./fixtures/valid -rulesets apex-style -language apex > /dev/null; then +if ! pmd check --dir ./fixtures/valid --use-version apex-55 --rulesets rulesets/apex/quickstart.xml > /dev/null; then echo "failed" ret=1; -else +else echo "OK" fi echo -n "it should fail linting invalid apex code... " -if pmd -dir ./fixtures/invalid -rulesets apex-style -language apex > /dev/null; then +if pmd check --dir ./fixtures/invalid --use-version apex-55 --rulesets rulesets/apex/quickstart.xml > /dev/null; then echo "failed" ret=1; -else +else echo "OK" fi From f13150763dfee5dd4da4a344dcbeff3fe6002a71 Mon Sep 17 00:00:00 2001 From: Matthias Rolke Date: Tue, 2 Apr 2024 11:20:57 +0200 Subject: [PATCH 4/4] docs: use double dash for long flag --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89da8b9..d110c61 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ npm install --global pmd-bin ## Usage ```console -pmd -help +pmd --help ``` ## Maintenance