Skip to content

Commit fc3051f

Browse files
CHANGE @W-22270236@ - Upgrade PMD from 7.23.0 to 7.24.0 (#463)
1 parent df06264 commit fc3051f

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

packages/code-analyzer-pmd-engine/gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[versions]
99
hamcrest = "3.0"
1010
junit-jupiter = "5.14.3"
11-
pmd = "7.23.0" # !!! IMPORTANT !!! KEEP THIS IN SYNC WITH PMD_VERSION INSIDE OF: src/constants.ts
11+
pmd = "7.24.0" # !!! IMPORTANT !!! KEEP THIS IN SYNC WITH PMD_VERSION INSIDE OF: src/constants.ts
1212

1313
# For the following: Keep in sync with whatever pmd-core pulls in. Basically, we don't want duplicates in our java-lib folder.
1414
# To see pmd-core's dependencies, go to https://mvnrepository.com/artifact/net.sourceforge.pmd/pmd-core

packages/code-analyzer-pmd-engine/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/code-analyzer-pmd-engine",
33
"description": "Plugin package that adds 'pmd' and 'cpd' as engines into Salesforce Code Analyzer",
4-
"version": "0.40.0",
4+
"version": "0.41.0-SNAPSHOT",
55
"author": "The Salesforce Code Analyzer Team",
66
"license": "BSD-3-Clause",
77
"homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview",

packages/code-analyzer-pmd-engine/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// !!! IMPORTANT !!! KEEP THIS IN SYNC WITH gradle/libs.versions.toml
2-
export const PMD_VERSION: string = '7.23.0';
2+
export const PMD_VERSION: string = '7.24.0';
33

44
export const PMD_ENGINE_NAME: string = "pmd";
55
export const CPD_ENGINE_NAME: string = "cpd";

packages/code-analyzer-pmd-engine/src/pmd-rule-mappings.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ export const RULE_MAPPINGS: Record<string, {severity: SeverityLevel, tags: strin
116116
severity: SeverityLevel.Moderate,
117117
tags: [COMMON_TAGS.RECOMMENDED, COMMON_TAGS.CATEGORIES.ERROR_PRONE, COMMON_TAGS.LANGUAGES.APEX]
118118
},
119+
"AvoidInterfaceAsMapKey": {
120+
severity: SeverityLevel.Moderate,
121+
tags: [COMMON_TAGS.RECOMMENDED, COMMON_TAGS.CATEGORIES.ERROR_PRONE, COMMON_TAGS.LANGUAGES.APEX]
122+
},
119123
"AvoidLogicInTrigger": {
120124
severity: SeverityLevel.Moderate,
121125
tags: [COMMON_TAGS.RECOMMENDED, COMMON_TAGS.CATEGORIES.BEST_PRACTICES, COMMON_TAGS.LANGUAGES.APEX]

packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexOnly.goldfile.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,19 @@
427427
"https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_errorprone.html#avoidhardcodingid"
428428
]
429429
},
430+
{
431+
"name": "AvoidInterfaceAsMapKey",
432+
"severityLevel": 3,
433+
"tags": [
434+
"Recommended",
435+
"ErrorProne",
436+
"Apex"
437+
],
438+
"description": "In Apex, when a `Map` uses an interface as key and an abstract class implements that interface and defines `equals`/`hashCode`, methods like `containsKey` do not dispatch to the correct implementation. This results in potentially duplicated map entries or not being able to get entries by key. This rule reports `Map` declarations (fields, variables, parameters) whose key type is an... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_errorprone.html#avoidinterfaceasmapkey",
439+
"resourceUrls": [
440+
"https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_errorprone.html#avoidinterfaceasmapkey"
441+
]
442+
},
430443
{
431444
"name": "AvoidInvalidCrudContentDistribution",
432445
"severityLevel": 3,
@@ -1041,7 +1054,7 @@
10411054
"Design",
10421055
"Apex"
10431056
],
1044-
"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... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod",
1057+
"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. Apex Language Server is used to make this... Learn more: https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod",
10451058
"resourceUrls": [
10461059
"https://docs.pmd-code.org/pmd-doc-{{PMD_VERSION}}/pmd_rules_apex_design.html#unusedmethod"
10471060
]

0 commit comments

Comments
 (0)