Top 5 Source Code Analysis Tools for Salesforce Projects
A trigger with a SOQL query inside a loop passes every test in the sandbox, then hits governor limits the first time a data load runs in production. A class without a sharing declaration quietly shows users records they should never see. Neither bug looks wrong in a quick pull request review.
On many Salesforce projects, code review still means a senior developer skimming a pull request when there is time, a checklist in a Word document nobody opens, and security issues found by the AppExchange review or, worse, by an auditor. The same mistakes come back every sprint.
A static code analysis tool reads your Apex, Lightning components, Flows and metadata against hundreds of rules, and flags problems before the code is deployed: SOQL injection, missing CRUD and FLS checks, hardcoded IDs, DML in loops, weak tests. Run it in your IDE as you type, and as a quality gate on every pull request.
In 2026 this matters more than ever, because a growing share of Salesforce code is written by AI assistants such as Agentforce Vibes, Copilot and Claude. The best tools now scan AI-written code with the same rules, suggest fixes, and let you run scans or write custom rules by asking in plain English.
Here are five of the best static code analysis tools for Salesforce projects. Pick one, wire it into your pipeline, and let it catch what reviewers miss. 🛡️
🔎 How These Five Were Chosen
Salesforce code is not ordinary Java or JavaScript, so every tool here understands Apex and Salesforce-specific risks such as sharing, CRUD and FLS, and SOQL injection. Salesforce Code Analyzer is the official, free scanner that Salesforce requires for AppExchange security reviews, and PMD is the open-source engine behind most Apex rules. SonarQube is the most-reviewed static analysis product that works with Salesforce on G2, while CodeScan and Gearset Code Reviews are the leading Salesforce-specific platforms.
From older lists: Code Analyzer v4 was retired in August 2025 (use v5), Clayton is now Gearset Code Reviews after Gearset acquired it in September 2024, CodeScan is now part of AutoRABIT, and SonarCloud has been renamed SonarQube Cloud. The Force.com Source Code Scanner portal (powered by Checkmarx) is still available, but it is built for AppExchange security reviews; customer use is "introductory", capped at 360,000 lines a year, and automated or pipeline scans are not allowed. Prices are USD list prices as of October 2026; always confirm on the vendor's pricing page before you buy.
🔗 Useful links
1. Salesforce Code Analyzer
🌐 URL: developer.salesforce.com/docs/platform/salesforce-code-analyzer
Salesforce's own scanner, and the first tool every Salesforce team should switch on. Version 5 bundles eight engines behind one Salesforce CLI command, one VS Code extension and one GitHub Action.
🔑 Key features
Eight engines in one: PMD and CPD for Apex and Visualforce, ESLint for LWC and JavaScript, RetireJS, Regex, Flow Scanner, Salesforce Graph Engine and ApexGuru
Flow Scanner audits Flows for security and design issues, alongside your code
AppExchange security rules, the same checks Salesforce expects before a security review
One code-analyzer.yml file to set rules, severities and custom Regex or PMD rules for the whole team
Severity thresholds that fail a build, plus an official GitHub Action that summarises violations on each run
✨ AI capability
ApexGuru, an AI-driven engine, connects to your org through the Salesforce CLI and flags SOQL inefficiencies and scalability issues line by line. Agentforce for Developers suggests quick fixes for many Apex PMD violations in VS Code. Agent Skills come preinstalled in Agentforce Vibes 2.0 and can be added to Claude Code or Cursor, so you can run scans, configure the tool or create custom PMD rules in plain English. The older MCP tools stopped being supported in June 2026.
💰 Free or paid
Free for all Salesforce developers. Install it as a Salesforce CLI plugin or as part of the Salesforce Extension Pack in VS Code.
⚡ Why it matters for Salesforce professionals
Required for AppExchange (now AgentExchange) security reviews, so ISV partners have to use it anyway
Scans Flows as well as code, so admins and developers share one quality gate
Fits any Salesforce DX project, and runs in any CI pipeline through the Salesforce CLI or the official GitHub Action
🔗 Useful links
2. PMD
🌐 URL: pmd.github.io
The open-source static analyser that finds common programming flaws such as unused variables, empty catch blocks and unnecessary object creation. Most Apex rules you see in other tools, including Code Analyzer, are PMD rules underneath.
🔑 Key features
Apex and Visualforce rules grouped into Best Practices, Code Style, Design, Documentation, Error Prone, Performance and Security
Custom rules written as XPath queries or in Java, so you can enforce your own coding standards
Current with the platform: PMD 7.27.0 (August 2026) supports Apex for Summer '26, including multiline strings
CPD (copy-paste detector) finds duplicated Apex across classes
Runs anywhere Java runs: command line, Maven, Gradle, Jenkins, GitLab CI or Azure Pipelines
✨ AI capability
PMD has no built-in AI. If you want help writing custom PMD rules, Code Analyzer's Agent Skills can generate the XPath for you.
💰 Free or paid
Free and open source. The community Apex PMD extension for VS Code, with over 700,000 installs, shows violations as you type.
⚡ Why it matters for Salesforce professionals
A lightweight way to add Apex checks to a pipeline that isn't GitHub, without installing the Salesforce CLI
Custom rules let architects enforce project standards such as trigger frameworks or naming conventions
Learning PMD rules pays off everywhere, because the same rules power Code Analyzer, CodeScan and others
New to PMD? Read our step-by-step guide: #Salesforce Code Scanner - How to Bake Quality in Your Code with Apex PMD
🔗 Useful links
3. Gearset Code Reviews
🌐 URL: gearset.com/solutions/code-analysis
Formerly Clayton, the Salesforce-specific code review platform Gearset acquired in 2024. It reviews configuration as well as code, and posts findings and fixes straight into your pull requests.
🔑 Key features
Scans over 300 Salesforce metadata types: Apex, Flows, LWC, Aura, Visualforce, Agentforce, permission sets, profiles and field-level security
Inline feedback on pull requests in GitHub, GitLab, Bitbucket and Azure DevOps
Protection Mode separates new issues from existing technical debt, so teams can block new problems without fixing the past first
Predefined rules plus custom, organisation-wide policies
Trend dashboards for code quality across teams and orgs, and a VS Code extension
✨ AI capability
The scanning is deliberately deterministic, not AI-based, so it applies the same checks to code written by people and by AI assistants. Suggested autofixes can be applied to the pull request automatically. Gearset's Cam AI agent is a separate product.
💰 Free or paid
No free plan, but a 30-day free trial with nothing to install in your orgs. Gearset lists Code Reviews at $150–160 per contributor per month, or by quote; check the pricing page for your team size.
⚡ Why it matters for Salesforce professionals
Catches risky permission set, profile and Flow changes that code-only scanners never see
Works with Gearset Pipelines, and with other Git-based pipelines through native Git integrations
Protection Mode makes it practical on large, older orgs full of legacy Apex
🔗 Useful links
4. CodeScan by AutoRABIT
🌐 URL: codescan.io
A static analysis tool built only for Salesforce, now part of AutoRABIT's DevSecOps suite. It suits regulated industries that need strict coding standards and an audit trail for every merge.
🔑 Key features
More than 3,100 rules, around 800 of them specific to Salesforce
Covers Apex, Visualforce, Lightning Web Components and metadata such as triggers, objects and relationships
Quality gates and custom rule sets that block merges failing your standards
IDE plugins for real-time feedback, plus integrations with Git, Jenkins and other CI/CD tools
Choice of CodeScan Cloud or self-hosted deployment
✨ AI capability
AutoRABIT positions CodeScan as the governance layer for AI-assisted development, applying the same standards to AI-generated code as to hand-written code. It does not advertise AI-generated fixes.
💰 Free or paid
No published pricing. AutoRABIT offers a free Salesforce code assessment and a live demo, so expect a quote-based contract.
⚡ Why it matters for Salesforce professionals
Deep Salesforce-only rules mean fewer false positives than generic security scanners
Pairs with AutoRABIT ARM for CI/CD and Vault for backup if you want one DevSecOps vendor
Self-hosting helps where security teams won't allow source code to leave the network
🔗 Useful links
5. SonarQube by SonarSource
🌐 URL: sonarsource.com/products/sonarqube
The code quality platform most enterprises already run for Java, .NET and JavaScript. If your Salesforce team sits inside a larger engineering organisation, adding Apex to the existing SonarQube gate is often the easiest sell.
🔑 Key features
Apex rules for bugs, vulnerabilities and code smells, such as classes running SOQL or DML without a sharing declaration
Quality gates that fail a pull request on new issues, coverage or duplication
One dashboard for Apex, LWC JavaScript, MuleSoft DataWeave and the rest of your estate
SonarQube for IDE (formerly SonarLint) in VS Code, with Apex rules in connected mode
Available as SonarQube Cloud (formerly SonarCloud) or self-managed SonarQube Server
✨ AI capability
Sonar's AI features don't cover Apex yet: AI CodeFix supports languages such as Java, JavaScript, TypeScript, Python and C#. The free, open-source SonarQube MCP server lets AI assistants pull issues and quality gate results into your editor, and SonarQube Cloud Enterprise adds a Remediation Agent.
💰 Free or paid
SonarQube Cloud has a free plan up to 50,000 lines and Team from $34 a month, but Apex is only included in the Enterprise plans of SonarQube Cloud and SonarQube Server, which are priced on request by lines of code.
⚡ Why it matters for Salesforce professionals
Puts Salesforce code under the same governance as the rest of the business, which architects and CISOs like
Already approved in many enterprises, so there is often no new vendor to onboard
Runs in Jenkins, GitHub Actions, GitLab CI or Azure Pipelines, and Salesforce DevOps tools such as Flosum integrate with it
🔗 Useful links
📊 The Top 5 at a Glance
🧭 Which One Should You Choose?
The best scanner is the one that runs on every change, not the one with the most rules. Start from what you need most:
Want a free, official starting point that also covers Flows? Choose Salesforce Code Analyzer.
Need custom Apex rules in any CI tool, at zero cost? Choose PMD.
Want Flows, permissions and metadata reviewed in every pull request? Choose Gearset Code Reviews.
Regulated organisation that needs strict standards and self-hosting? Choose CodeScan.
Enterprise that wants one quality gate for Java, JavaScript and Apex? Choose SonarQube.
💡 Honourable Mentions: Checkmarx and Quality Clouds
Checkmarx powers the Source Code Scanner Salesforce runs for AppExchange security reviews, and was named a Leader in the 2025 Gartner Magic Quadrant for Application Security Testing for the seventh time; ISV partners get three scans per solution version with the review fee, with more available on a Checkmarx licence. Quality Clouds takes a different angle, scanning whole orgs for code, configuration and Flow issues and checking AI-generated code in VS Code; pricing is on request.
🔗 Useful links
✅ Turn On One Gate This Week
Start small: install Code Analyzer in VS Code, agree a short list of severity 1 and 2 rules with your team, and add a check that fails any pull request that breaks them. Fix new issues first and chip away at the backlog later. If your team isn't on Git yet, start with our guides to Source and Version Control Tools and CI/CD Tools, and set up your editor with IDEs for Salesforce Development.
So retire review_checklist.docx. Let a scanner check every change, and save your reviewers for the design decisions only people can make.
Which code analysis tool does your team run today? Share it in the comments 👇