Code Reviews is Gearset's static code analysis tool for Salesforce. It scans your Git repositories, pull requests (PRs), and Salesforce orgs for security and quality issues, so you can fix them before they reach production.
What does Code Reviews check?
Code Reviews checks your code and configuration against more than 100 rules. Many of the rules are based on two public standards:
The OWASP Top 10. The OWASP Top 10 is a standard awareness document for developers. It lists ten categories of web application security risk, such as broken access control and injection.
Salesforce Well-Architected. The Salesforce Well-Architected framework is Salesforce's guidance for designing trustworthy solutions. In your scan results, the tags column shows the Well-Architected policy linked to each issue, such as Secure or Compliant.
Code Reviews rules cover these metadata types:
Agentforce
Apex
Aura
Flow
Lightning Web Components (LWC)
Visualforce
Other metadata, such as custom objects, permission sets, and profiles
Each rule has a severity: Critical, Error, or Warning. For the file types Code Reviews scans, see What does Code Reviews review?
What are some examples of Code Reviews rules?
Each Code Reviews rule checks for one specific problem. For the full list, see the Code Reviews rules summary.
Can Code Reviews block a PR?
Yes, but Code Reviews doesn't block merges by itself. Blocking needs to be paired with configuration in your Git provider: set up a branch protection rule, also called a quality gate, to block PRs that have issues. See the gating section of Code Reviews repository settings for the guide for your provider.
In a pipeline, a PR with Critical or Error issues shows a warning. The warning is a reminder to check the scan results. Gearset doesn't block the promotion.
How does Code Reviews help me fix issues?
Code Reviews gives you three ways to understand and fix an issue:
The
Explaintab on an issue summarizes the issue, explains why it matters, and shows you how to fix it.Autofix creates a PR that fixes the issues for a specific set of rules. You can check the changes in your Git provider before you merge. See Using Autofix in Code Reviews.
Each rule has its own help article, with examples and steps to fix violations.
Can I change the rules Code Reviews uses?
Yes. Team owners can turn each Code Reviews rule on or off for a repository, and change its severity. Go to the Rules tab on the repository Settings page. See How to edit Code Reviews rules in Gearset.
How do I start a Code Reviews trial?
Code Reviews has a 30-day trial. Only team owners can start it.
In the left-hand menu, click
Code reviews.Click
Get Started.Select the repository you want to scan.
For the full steps, see Setting up a Code Reviews trial.
Where can I learn more about the standards behind Code Reviews rules?
These Salesforce and OWASP resources explain the security and quality practices that Code Reviews rules check for:
OWASP Top 10: the full list of risk categories, with examples and prevention advice.
Salesforce Well-Architected: Salesforce's framework for building healthy solutions.
Salesforce Secure Coding Guidelines: Salesforce's reference on common security issues, such as cross-site scripting, SOQL injection, and storing sensitive data.
Learn the OWASP Top 10: a Trailhead unit in the Security Principles module.
Develop Secure Web Apps: a Trailhead trail on how to detect and prevent common vulnerabilities in your code.
