Salesforce Code Analyzer is the official static analysis tool from Salesforce. One command runs PMD, ESLint, RetireJS, a Regex engine, Flow Scanner, the Salesforce Graph Engine and a copy-paste detector over your Apex, Visualforce, Lightning components and Flows. It is free, open source under the BSD-3-Clause license, and its scan report is a required upload for the AppExchange security review.
Price
Free
Type
Command line
Source code
Open source (BSD-3-Clause)
Made by
Salesforce
What Code Analyzer does
- Runs over 500 built-in rules across Apex, Visualforce, Flows and Lightning components in one pass.
- Selects rules by tag.
--rule-selector AppExchangeand--rule-selector Recommended:Securityproduce the report the security review asks for. - Writes results to the terminal or to a file. The file extension picks the format, for example
.htmlor.csv. - Works from Salesforce CLI, VS Code, GitHub Actions and DevOps Center.
- Reads its settings from a
code-analyzer.ymlfile, so a team can share one rule set.
When it helps, and when it does not
Reach for it when
You want one quality gate in a pipeline, or you are preparing a managed package for security review. Salesforce requires the Code Analyzer scan report as part of that submission.
Look elsewhere when
You are still on version 4 commands (sf scanner). Version 4 was retired in August 2025 and is no longer supported, so move to version 5 first. For a declarative-only org, a Flow-focused scanner may be all you need.
The full fact sheet
record: Applast checked
- Type
- Salesforce CLI plugin and Visual Studio Code extension source
- Price
- Free. The VS Code extension is listed as Free and licensed at no charge. Cost or licensing of the ApexGuru engine is not stated. source
- Made by
- Salesforce source
- Open source
- Yes, BSD-3-Clause license source
- Where your data goes
- The engines read files on your machine. ApexGuru, added in version 5.16.0, is the exception and scans a connected org. The VS Code extension terms say Salesforce may collect usage data about the extension. source
- Requirements
- Salesforce CLI. Java JDK 11 or later for PMD, CPD and the Graph Engine. Python 3.10 or later for Flow Scanner. source
- Engines in version 5
- PMD, CPD, ESLint, RetireJS, Regex, Flow Scanner, Salesforce Graph Engine, and ApexGuru since 5.16.0. All are bundled and enabled by default. source
- Latest version
- 5.16.0, released August 26, 2026 source
- Usage
- 117,543 npm downloads a week. 893,922 installs of the VS Code extension. source
- Install
sf plugins install @salesforce/plugin-code-analyzer. The firstsf code-analyzercommand also installs it automatically. source
First-hand note
I used it for the security review of Org Overview 360: I ran Code Analyzer locally with the AppExchange and Security rule selectors until it reported zero violations, before spending one of the limited runs of the official source scanner. The full submission is in this story.
Alternatives and related tools
Lightning Flow Scanner
Org package
Checks your flows against a community rule set, inside the org, from the command line, in VS Code or in a pipeline.
Salesforce Extensions for VS Code
Editor extension
The official extension pack that turns Visual Studio Code into the standard Salesforce IDE.
sfdx-hardis
Command line
An open source toolbox for Salesforce CI/CD pipelines, metadata backup, org monitoring and documentation.
All of them side by side: Salesforce developer tools list.
Frequently asked questions
Is Salesforce Code Analyzer free?
Yes. It is open source under the BSD-3-Clause license, and the VS Code extension is listed as Free with terms that grant the license at no charge. Whether the ApexGuru engine needs a separate license is not stated in the Code Analyzer documentation.
Is Code Analyzer required for the AppExchange security review?
Yes. The documentation says that a managed package listed on AppExchange must pass security review and that you are also required to upload your Salesforce Code Analyzer scan reports. The same docs note that the scans do not have to be 100 percent passing.
Which command creates the security review report?
sf code-analyzer run --rule-selector AppExchange --rule-selector Recommended:Security --output-file CodeAnalyzerReport.html
What happened to Code Analyzer v4 and sfdx-scanner?
Version 4 was retired in August 2025 and is no longer supported. Version 5 is a different plugin, @salesforce/plugin-code-analyzer, with the command topic sf code-analyzer in place of sf scanner.
Which engines does Code Analyzer v5 include?
PMD, CPD (copy-paste detector), ESLint, RetireJS, Regex, Flow Scanner and the Salesforce Graph Engine, all bundled and enabled by default. ApexGuru was added in version 5.16.0.
Does Code Analyzer scan Flows?
Yes. Version 5 added a Flow Scanner engine. It needs Python 3.10 or later on the machine that runs the scan.
Related on SF Updates
- Story: everything I submitted to pass the security review in 11 days
- Story: AgentExchange listing SEO
Sources
Every fact on this page comes from the tool's own pages, read on . Show the 8 pages.
- developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview
- developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engines.html
- developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/analyze.html
- developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/appexchange.html
- developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/migrate.html
- github.com/forcedotcom/code-analyzer
- npmjs.com/package/@salesforce/plugin-code-analyzer
- marketplace.visualstudio.com/items?itemName=salesforce.sfdx-code-analyzer-vscode
Facts checked against each tool's own pages on November 24, 2026. No tool paid to be listed and there are no affiliate links. Logos belong to their owners and are shown only to identify each tool. Spotted something out of date? info@sfupdates.com.