Salesforce Code Analyzer: engines, install and the security review report

10 facts checked

One command that runs several static analysis engines over Apex, Lightning components and Flows.

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.

DocumentationVS Code extensionSource on GitHub

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 AppExchange and --rule-selector Recommended:Security produce the report the security review asks for.
  • Writes results to the terminal or to a file. The file extension picks the format, for example .html or .csv.
  • Works from Salesforce CLI, VS Code, GitHub Actions and DevOps Center.
  • Reads its settings from a code-analyzer.yml file, 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 first sf code-analyzer command 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

Checks your flows against a community rule set, inside the org, from the command line, in VS Code or in a pipeline.

FreeOpen source

The official extension pack that turns Visual Studio Code into the standard Salesforce IDE.

FreeOpen sourceBy Salesforce

sfdx-hardis

Command line

An open source toolbox for Salesforce CI/CD pipelines, metadata backup, org monitoring and documentation.

FreeOpen source

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.

Sources

Every fact on this page comes from the tool's own pages, read on . Show the 8 pages.

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.

← All Salesforce toolsSalesforce developer tools list →

📅 Winter '27 Key Dates

Winter '27 Production Rollout
Live on all instances
The rollout is complete.

Spring '27 Sandbox Preview
Jan 8, 2027
Test new features safely before production.

Spring '27 Production Rollout
Jan 16, Feb 6 and Feb 20, 2027
Main release weekends, from Salesforce Trust.