Overview Version History Q & A Rating & Review
PMD Apex Auto-Fixer
A VS Code extension for Salesforce projects that:
Runs PMD against Apex classes, triggers (and other selected files) in your SFDX project.
Lists the files with PMD findings in a dedicated "PMD Apex Fixer" view, with each violation underneath its file.
Lets you check one or more files and fix them automatically with Claude (Anthropic), showing a diff you accept or reject per file before anything is written to disk.
Requirements
Java (8+) available on PATH, or configured via pmdApexFixer.javaHome. PMD itself is downloaded automatically on first use.
An Anthropic API key .
Getting started
Run PMD Apex Fixer: Set Claude API Key from the Command Palette. The key is stored in VS Code's encrypted Secret Storage.
Run PMD Apex Fixer: Scan Workspace , or right-click a folder/file in the Explorer and choose PMD Apex Fixer: Scan Selected Files/Folder .
Open the PMD Apex Fixer view in the Activity Bar. Check the files you want fixed.
Click the sparkle icon (Fix Checked Files with Claude ) in the view's title bar.
For each file, review the diff between the original and Claude's proposed fix, then Accept Fix or Reject .
Configuration
Setting
Description
pmdApexFixer.claudeModel
Claude model used to generate fixes (default claude-sonnet-5).
pmdApexFixer.pmdVersion
PMD release to auto-download (default 7.9.0).
pmdApexFixer.pmdInstallPath
Use an existing PMD install instead of auto-downloading (path to the directory containing bin/).
pmdApexFixer.rulesetPath
Path to a custom PMD ruleset XML. Defaults to a bundled ruleset covering PMD's built-in Apex categories.
pmdApexFixer.javaHome
JAVA_HOME to use if Java isn't already on PATH.
pmdApexFixer.includeGlobs / pmdApexFixer.excludeGlobs
Control which files "Scan Workspace" picks up.
pmdApexFixer.maxDiagnosticsPerFileInPrompt
Caps how many violations are sent to Claude per file.
Notes
Only .cls and .trigger files are scanned/fixed — PMD's Apex rules don't apply to Visualforce pages, LWC, or Aura components.
Nothing is written to disk without an explicit Accept Fix in the diff prompt.
PMD is downloaded once into VS Code's global storage and reused across projects.
Development
npm install
npm run compile # or: npm run watch
Press F5 in VS Code to launch an Extension Development Host.