diff --git a/package-lock.json b/package-lock.json index 40600517..60a45828 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6598,7 +6598,7 @@ }, "packages/code-analyzer-pmd-engine": { "name": "@salesforce/code-analyzer-pmd-engine", - "version": "0.14.0", + "version": "0.14.1-SNAPSHOT", "license": "BSD-3-Clause", "dependencies": { "@salesforce/code-analyzer-engine-api": "0.14.0", diff --git a/packages/code-analyzer-pmd-engine/gradle/libs.versions.toml b/packages/code-analyzer-pmd-engine/gradle/libs.versions.toml index 224c0e64..1ac7cd46 100644 --- a/packages/code-analyzer-pmd-engine/gradle/libs.versions.toml +++ b/packages/code-analyzer-pmd-engine/gradle/libs.versions.toml @@ -9,7 +9,7 @@ gson = "2.11.0" hamcrest = "2.2" junit-jupiter = "5.10.2" -pmd = "7.7.0" # !!! IMPORTANT !!! KEEP THIS IN SYNC WITH PMD_VERSION INSIDE OF: src/constants.ts +pmd = "7.8.0" # !!! IMPORTANT !!! KEEP THIS IN SYNC WITH PMD_VERSION INSIDE OF: src/constants.ts slf4j-nop = "2.0.13" # For now, we throw slf4j logs away (using this no-op module). We might use an actual logger in the future. [libraries] diff --git a/packages/code-analyzer-pmd-engine/src/constants.ts b/packages/code-analyzer-pmd-engine/src/constants.ts index 4eb10545..8e250f3b 100644 --- a/packages/code-analyzer-pmd-engine/src/constants.ts +++ b/packages/code-analyzer-pmd-engine/src/constants.ts @@ -1,5 +1,5 @@ // !!! IMPORTANT !!! KEEP THIS IN SYNC WITH gradle/libs.versions.toml -export const PMD_VERSION: string = '7.7.0'; +export const PMD_VERSION: string = '7.8.0'; export const PMD_ENGINE_NAME: string = "pmd"; export const CPD_ENGINE_NAME: string = "cpd"; diff --git a/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_allLanguages.goldfile.json b/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_allLanguages.goldfile.json index 657f1e6a..9646e26c 100644 --- a/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_allLanguages.goldfile.json +++ b/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_allLanguages.goldfile.json @@ -922,6 +922,19 @@ "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_codestyle.html#propertynamingconventions" ] }, + { + "name": "QueueableWithoutFinalizer", + "severityLevel": 4, + "tags": [ + "Recommended", + "BestPractices", + "apexLanguage" + ], + "description": "Detects when the Queueable interface is used but a Finalizer is not attached. It is best practice to call the `System.attachFinalizer(Finalizer f)` method within the `execute` method of a class which implements the `Queueable` interface. Without attaching a Finalizer, there is no way of designing error recovery actions should the Queueable action fail.", + "resourceUrls": [ + "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_bestpractices.html#queueablewithoutfinalizer" + ] + }, { "name": "ScopeForInVariable", "severityLevel": 2, @@ -1047,7 +1060,7 @@ "Design", "apexLanguage" ], - "description": "Avoid having unused methods since they make understanding and maintaining code harder. This rule finds not only unused private methods, but public methods as well. ApexLink is used to make this possible and this needs additional configuration. The environment variable `PMD_APEX_ROOT_DIRECTORY` needs to be set prior to executing PMD. With this variable the root directory of the Salesforce metadata,... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod", + "description": "Avoid having unused methods since they make understanding and maintaining code harder. This rule finds not only unused private methods, but public methods as well, as long as the class itself is not entirely unused. A class is considered used, if it contains at least one other method/variable declaration that is used, as shown in the test project file Foo.cls. ApexLink is used to make this possible and... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod", "resourceUrls": [ "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod" ] diff --git a/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexAndVisualforce.goldfile.json b/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexAndVisualforce.goldfile.json index cf5a827c..644dd152 100644 --- a/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexAndVisualforce.goldfile.json +++ b/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexAndVisualforce.goldfile.json @@ -727,6 +727,19 @@ "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_codestyle.html#propertynamingconventions" ] }, + { + "name": "QueueableWithoutFinalizer", + "severityLevel": 4, + "tags": [ + "Recommended", + "BestPractices", + "apexLanguage" + ], + "description": "Detects when the Queueable interface is used but a Finalizer is not attached. It is best practice to call the `System.attachFinalizer(Finalizer f)` method within the `execute` method of a class which implements the `Queueable` interface. Without attaching a Finalizer, there is no way of designing error recovery actions should the Queueable action fail.", + "resourceUrls": [ + "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_bestpractices.html#queueablewithoutfinalizer" + ] + }, { "name": "StdCyclomaticComplexity", "severityLevel": 3, @@ -787,7 +800,7 @@ "Design", "apexLanguage" ], - "description": "Avoid having unused methods since they make understanding and maintaining code harder. This rule finds not only unused private methods, but public methods as well. ApexLink is used to make this possible and this needs additional configuration. The environment variable `PMD_APEX_ROOT_DIRECTORY` needs to be set prior to executing PMD. With this variable the root directory of the Salesforce metadata,... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod", + "description": "Avoid having unused methods since they make understanding and maintaining code harder. This rule finds not only unused private methods, but public methods as well, as long as the class itself is not entirely unused. A class is considered used, if it contains at least one other method/variable declaration that is used, as shown in the test project file Foo.cls. ApexLink is used to make this possible and... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod", "resourceUrls": [ "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod" ] diff --git a/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexOnly.goldfile.json b/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexOnly.goldfile.json index 005d1d29..b907d005 100644 --- a/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexOnly.goldfile.json +++ b/packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexOnly.goldfile.json @@ -727,6 +727,19 @@ "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_codestyle.html#propertynamingconventions" ] }, + { + "name": "QueueableWithoutFinalizer", + "severityLevel": 4, + "tags": [ + "Recommended", + "BestPractices", + "apexLanguage" + ], + "description": "Detects when the Queueable interface is used but a Finalizer is not attached. It is best practice to call the `System.attachFinalizer(Finalizer f)` method within the `execute` method of a class which implements the `Queueable` interface. Without attaching a Finalizer, there is no way of designing error recovery actions should the Queueable action fail.", + "resourceUrls": [ + "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_bestpractices.html#queueablewithoutfinalizer" + ] + }, { "name": "StdCyclomaticComplexity", "severityLevel": 3, @@ -787,7 +800,7 @@ "Design", "apexLanguage" ], - "description": "Avoid having unused methods since they make understanding and maintaining code harder. This rule finds not only unused private methods, but public methods as well. ApexLink is used to make this possible and this needs additional configuration. The environment variable `PMD_APEX_ROOT_DIRECTORY` needs to be set prior to executing PMD. With this variable the root directory of the Salesforce metadata,... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod", + "description": "Avoid having unused methods since they make understanding and maintaining code harder. This rule finds not only unused private methods, but public methods as well, as long as the class itself is not entirely unused. A class is considered used, if it contains at least one other method/variable declaration that is used, as shown in the test project file Foo.cls. ApexLink is used to make this possible and... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod", "resourceUrls": [ "https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod" ]