Quality Gate
Code Review Checklist
Run through this before every PR. Catches the most common Salesforce-specific issues.
-
No SOQL/DML inside loops. All queries are before loops; results stored in Maps for O(1) access inside loop bodies.
-
Trigger is thin. Zero business logic in .trigger file — all work delegated to a handler class.
-
Code handles bulk. All methods accept List/Map arguments. Nothing assumes Trigger.new has exactly 1 record.
-
Error handling is present. Database.SaveResult errors are checked; exceptions are caught and logged — not swallowed silently.
-
Tests use @TestSetup and cover negative cases (bulk of 200, exceptions, partial failures). Assert on specifics, not just "no exception".
-
Review sharing model. Does the class need
with sharingorwithout sharing? Is it intentional? -
Callout + DML ordering. If method does callouts AND DML, callouts must complete before any DML (or use @future).
-
No hardcoded IDs. RecordTypeId, ProfileId, etc. must be queried by DeveloperName — not hardcoded org-specific IDs.
-
No String.format SOQL. Dynamic SOQL must sanitize inputs with
String.escapeSingleQuotes()to prevent injection. -
No SELECT *. Always specify exact fields. Wildcard queries are not supported and specifying all fields causes unnecessary data transfer.