Skip to content

fix: [BUG] Bundled PMD 7.25.0 cannot load custom rulesets referencing PMD 7.26.0 rules — one unresolvable ref disables the whole ruleset (#2065)#480

Closed
nikhil-mittal-165 wants to merge 1 commit into
devfrom
fix/issue-2065-bump-pmd-7.26.0
Closed

fix: [BUG] Bundled PMD 7.25.0 cannot load custom rulesets referencing PMD 7.26.0 rules — one unresolvable ref disables the whole ruleset (#2065)#480
nikhil-mittal-165 wants to merge 1 commit into
devfrom
fix/issue-2065-bump-pmd-7.26.0

Conversation

@nikhil-mittal-165

Copy link
Copy Markdown
Contributor

Summary

Fixes forcedotcom/code-analyzer#2065

Root Cause

The @salesforce/code-analyzer-pmd-engine package bundles PMD 7.25.0 (defined in packages/code-analyzer-pmd-engine/src/constants.ts and packages/code-analyzer-pmd-engine/gradle/libs.versions.toml). When a user's custom ruleset references a rule that only exists in PMD 7.26.0 (e.g. InvocableClassNoArgConstructor added 2026-06-29), PMD throws a RuleSetLoadException because the rule cannot be resolved against the bundled 7.25.0 jars. PMD's all-or-nothing ruleset loading semantics mean the entire custom ruleset fails to load, disabling every rule in it. The fix is to bump the bundled PMD version from 7.25.0 to 7.26.0 in the 3 files that changed in the previous upgrade (commit abccdd0): constants.ts, libs.versions.toml, and package.json. This is a well-established upgrade pattern the team performs monthly.

Fix

Bumped bundled PMD from 7.25.0 to 7.26.0 and added new InvocableClassNoArgConstructor rule to RULE_MAPPINGS and goldfile. All 127 tests pass.

Testing

  • ✅ Unit tests added/updated
  • ✅ All tests passing
  • ✅ Lint checks passing

Functional Testing Evidence

Tested on Dreamhouse project:

  • Test 1: Custom PMD 7.26.0 ruleset loads successfully - PASS; Verified pmd-apex-7.26.0.jar, pmd-core-7.26.0.jar, pmd-javascript-7.26.0.jar in bundle
  • Test 2: PMD scan executes on Dreamhouse Sample.cls with custom ruleset - PASS; Found 4 violations (ApexDoc missing, AvoidDebugStatements, DebugsShouldUseLoggingLevel); Ruleset loading and rule execution completed without RuleSetLoadException errors

Overall Status: PASS ✅

Files Changed

  • packages/code-analyzer-pmd-engine/src/constants.ts
  • packages/code-analyzer-pmd-engine/gradle/libs.versions.toml
  • packages/code-analyzer-pmd-engine/package.json
  • packages/code-analyzer-pmd-engine/src/pmd-rule-mappings.ts
  • packages/code-analyzer-pmd-engine/test/test-data/pmdGoldfiles/rules_apexOnly.goldfile.json

Upgrades bundled PMD version to 7.26.0 so that custom rulesets
referencing rules added in PMD 7.26.0 (e.g. InvocableClassNoArgConstructor)
can be loaded without RuleSetLoadException.

Updates version references in constants.ts, libs.versions.toml, and
package.json. Adds InvocableClassNoArgConstructor to RULE_MAPPINGS and
apex goldfile.
@git2gus

git2gus Bot commented Jul 13, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Bundled PMD 7.25.0 cannot load custom rulesets referencing PMD 7.26.0 rules — one unresolvable ref disables the whole ruleset

1 participant