Code Scanning - Guide
Who this page is for: developers who set up the checks, fix what they flag and suppress false positives; architects who design quality gates, choose the priority tiers to enforce and plan a phased adoption; and DevOps engineers who add the checks to deployment pipelines.
New to it? Try Fast Start - Code Scanning first. Deciding whether to use KernDX? See Why KernDX.
Copy this first
sf code-analyzer run --config-file code-analyzer.yml --target force-app/ --view detail
npm run lint
node scanner/validate-naming.js force-appWhat this does: checks everything in force-app once, from your project folder, one checker per line: your Apex (PMD, through Salesforce Code Analyzer v5), your Lightning web component JavaScript (ESLint), and the names of your Flows and custom objects (a Node script). Each check lists what it found; none of them changes your code.
Read next: What each checker looks for, Set up a first scan, What each rule means, Turn off a check for one line, Run the checks in your pipeline.
Quick Navigation
| I need to... | Go to... |
|---|---|
| Understand a PMD violation and how to fix it | PMD Rule Reference |
| See all 28 PMD rules and their priorities at a glance | PMD Rule Summary Table |
| Fix an ESLint error in my LWC | ESLint Rules (LWC) |
| Check Flow and Custom Object names | Naming Validator (Flows & Custom Objects) |
| Use my own org's naming convention | Building Org-Specific Rules |
| Keep passwords, tokens and keys out of the repository | Secret Scanning |
| Check source against the target org before a deployment | Deploy-Time Scanners |
| Suppress a rule for a valid reason | Suppression |
| Review the places where code turns a safety check off on purpose | KernSecurityBypassCallSite |
| See violations in VS Code or IntelliJ as I type | IDE Integration |
| Add scanning to a CI/CD pipeline | CI/CD Integration |
| Plan a phased rollout over an existing codebase | Phased Adoption Strategy |
| Find out why my tool cannot load the rules | PMD Version Compatibility |
| Understand how the three checkers fit together | How does it work? |
| See why KernDX is worth using | Why KernDX: the code scanning example |
Quick start
Pick where you want the checks to run:
| You want to... | What to do |
|---|---|
| Get a first scan running | The short walkthrough in Fast Start - Code Scanning |
| Check the whole project once | The three commands under Copy this first |
| See violations in your editor as you type | IDE Integration |
| Check every change before it reaches an org | CI/CD Integration |
Namespaces in code samples:
kern.on a class andkern__on an object, field, or metadata type mark the managed package's namespace. On the managed package, framework references need those prefixes even where a sample omits them; repackaged under your own namespace, replacekern/kern__with your prefix; on an unmanaged deploy, drop them. See How to read the code samples.
What problem does this solve?
A framework only helps if people actually use it. Nothing stops a developer from writing a plain insert record; or a raw System.debug() instead of the framework's safer equivalent, and on a busy team those shortcuts pile up until the framework's guarantees no longer hold.
The checkers in this guide (together, "the scanner") watch your code and flag those shortcuts automatically, so they get caught and fixed instead of quietly piling up. You see a problem in your editor as you type, or in your build pipeline before the code reaches a Salesforce org.
Mental model
Think of the scanner as a spell-checker for your code, but one that knows your house style. A spell-checker underlines a misspelt word as you type and flags the rest in one pass before you publish.
The scanner works the same way: it underlines a framework shortcut in your editor as you write, and catches any that slip through in the build before the code reaches an org. It does not rewrite your code for you; it points at the line and tells you the safer phrasing to use instead.
Use this when
- You want the framework's safer patterns (one query layer, transactional DML, structured logging) to hold across a team, not just when each developer remembers them.
- You are setting up code quality gates in CI/CD and want them to fail a build before a risky pattern reaches an org.
- You want violations underlined in your editor as you type, so they are cheap to fix.
- You are rolling out KernDX over an existing codebase and need a staged way to bring it into line.
- You want your own org's Flow, Object, Apex, and LWC naming conventions enforced automatically.
Don't use this when
- You are not using KernDX patterns at all. These rules check for framework shortcuts (inline SOQL instead of a selector, raw DML instead of
DML_Builder, and so on). If a file does not use the framework, there is nothing here for it to enforce. - You only need generic code-quality checks (cyclomatic complexity, unused variables, and the like) with no KernDX framework involved. The standard PMD and ESLint rulesets that ship with Salesforce Code Analyzer cover those without these custom rules.
- You want a tool that fixes violations for you. This reports and explains; it does not auto-rewrite. You make the change.
How does it work?
What each checker covers
Salesforce code comes in different shapes, and no single tool can read all of them. So the scanner uses three checkers, each matched to the kind of file it reads best. They live in the scanner/ directory:
| Checker | Reads | Checks |
|---|---|---|
| PMD rulesets | Your Apex code | Framework compliance, test-quality gates, and optional org-specific naming |
| ESLint plugin | Your Lightning Web Component (LWC) JavaScript | The shared base class, blocking raw console output, naming, and Jest test-quality gates |
| Naming validator | Flows and Custom Objects | Naming, with a Node.js script that reads the declarative metadata the first two tools cannot |
The three run independently and do not overlap. PMD handles Apex, ESLint handles JavaScript, and the naming validator handles the XML and directory-based metadata neither of the others can read. Because none of them duplicates another's coverage, you run all three to check the whole project. Each one runs in your editor and in the build pipeline:
+----------------------------------+ +----------------------------------+ +----------------------------------+
| PMD Rulesets | | ESLint Plugin | | Naming Validator |
| (Apex classes & triggers) | | (LWC JavaScript) | | (Flows & Custom Objects) |
+----------------------------------+ +----------------------------------+ +----------------------------------+
| kerndx-pmd-ruleset.xml | | eslint-plugin-kerndx/ | | validate-naming.js |
| 28 rules, PMD >= 7.19.0 | | 8 ESLint rules | | Node.js script, org-specific |
| Framework anti-patterns | | ComponentBuilder, console, | | Flow & Custom Object naming |
| Priority 1/3/5 tiers | | component naming | | Configurable domains/brands |
+----------------------------------+ +----------------------------------+ +----------------------------------+
| | |
v v v
IDE (VS Code, IntelliJ) IDE (ESLint extension) CLI (node script)
CI/CD (Code Analyzer, Gearset, CI/CD (npm run lint) CI/CD (node command)
Copado, AutoRABIT, CodeScan)A fourth checker you may already have: ApexGuru. Salesforce's ApexGuru scans the Apex in a production or Full Copy Sandbox org for performance anti-patterns (common risky mistakes) and, from Winter '27, for duplicated code.
It does not overlap with the three checkers above, so run both when you have both. ApexGuru judges how your code behaves in the org; the KernDX rules judge whether it follows the framework's conventions before it gets there.
- Who has it: it comes at no extra cost with Unlimited Edition, Signature Success Plan and Scale Test, and it is not available in Government Cloud.
- In Code Analyzer it is opt-in only: Salesforce Code Analyzer can run ApexGuru as an engine, but it is in neither the engine list
kerndx scanruns by default nor Code Analyzer's own Recommended selection. - It needs the right org: unless the org it points at is a production or Full Copy Sandbox with ApexGuru enabled, it falls back to a static mode that reads only literal SOQL and DML, which the framework's query and DML builders do not produce.
- To turn it on: if you have an ApexGuru-enabled org, add
apex-gurutoscanner.rule_selectorand setengines.apexguru.target_orgto that org in yourcode-analyzer.yml; leave it off everywhere else.
The scanner files
| File | Scope | Purpose |
|---|---|---|
kerndx-pmd-ruleset.xml | Any KernDX org | 28 KernDX-authored XPath rules enforcing framework anti-patterns (inline SOQL, direct DML, System.debug, coverage theatre, inline DML in tests, etc.) |
kerndx-hygiene-ruleset.xml | Any Salesforce org (no framework needed) | Framework-agnostic tier: the six rules (test quality, security-bypass review, Flow-invocable constructors) that do not require the KernDX framework. kerndx init scaffolds this one when the repo does not use the framework. |
subscriber-naming-pmd-ruleset.xml | Your org (example) | Apex class naming (Domain_[Brand_]Layer_Name), trigger naming (TRG_ObjectName), 40-char limit |
combined-pmd-ruleset.xml | Both (single-file reference) | Includes both PMD rulesets via <rule ref="..."/>, for tools that accept only one ruleset file |
eslint-plugin-kerndx/ | Any KernDX org | 8 ESLint rules: ComponentBuilder usage, console.log blocking, LWC component naming, coverage-exempt justification, jest-theatre prevention, shared-fixture mutation prevention, hardcoded display-text detection, Jest mocks of c/ and lightning/ modules |
validate-naming.js | Org-specific | Flow and Custom Object naming validation, with configurable domains, brands, and flow types |
PMD Rule Reference
Every Apex rule, with what it flags, why, and what to write instead. All 28 PMD rules live in scanner/kerndx-pmd-ruleset.xml, and every one is KernDX-authored. They are sorted into three priority tiers, so you know which ones to fix first.
Under the hood, each rule is an XPath expression, targeting the PMD 7 engine, that scans the parsed form of your Apex (the abstract syntax tree, or AST) for a common risky mistake.
For current framework statistics, see Metrics.
| Priority | Meaning | Action Required |
|---|---|---|
| 1 | Blocker | Must fix before merge. Bypasses core framework abstractions. |
| 3 | Should Fix | Direct use of platform APIs that have framework wrappers. Fix during normal development. |
| 5 | Informational | Best practices. Teams may adopt incrementally. |
Priority 1 Blockers
A violation at this top priority means the code has stepped around the core of the framework, so the framework's guarantees no longer apply to it. Fix these before the code merges.
KernTriggerMustDelegate
The rule: a trigger body must contain only new TRG_Dispatcher().run(), so all real logic lives in handler classes the framework can control. See the trigger framework guide for the full picture.
Why: logic put directly in the trigger file runs outside the framework. It loses the configuration-driven run order, the master off-switches admins rely on, performance monitoring, and the ability to test the logic on its own.
What the rule detects:
- Every statement you write directly in the trigger body other than the call to
run(). That includes variable declarations, SOQL, DML, loops, conditionals, and calls to any other method. - A loop or an
ifthat wraps therun()call: the wrapper itself is extra logic in the trigger. - A trigger that never calls
run()at all, reported once, at the trigger itself. The usual case is a freshly generated trigger whose body is still empty: it runs none of the trigger actions configured for its object, and the deploy succeeds without a word.
// VIOLATION -- logic in trigger body
trigger AccountTrigger on Account (before insert)
{
for(Account record : Trigger.new)
{
record.Description = 'Set by trigger';
}
}
// CORRECT -- thin dispatcher, logic in handler classes
trigger TRG_Account on Account (before insert)
{
new TRG_Dispatcher().run();
}Why this is Priority 1: Trigger logic that skips
TRG_Dispatcheris stuck. An admin cannot switch it off in an incident viaTriggerSetting__mdt.BypassExecution__c. You cannot reorder it viaTriggerAction__mdt.Order__c. It never shows up in performance logging. And you cannot test it on its own.
KernNoInlineSOQL
The rule: every read goes through a SEL_* selector class, which runs on QRY_Builder, so every query runs through one consistent layer that enforces security, can be cached, and can be reused.
Why: a query written inline ([SELECT ...]) or with Database.query() is invisible to the framework: it skips the query cache, the data masking layer and the record of bypasses, follows only the class's sharing keyword instead of the builder's sharing controls, and on an API version below 67 also skips object and field permissions (FLS, which is permission checks on individual fields). It cannot be reused elsewhere.
What the rule detects: SoqlExpression nodes (inline [SELECT ...]) and calls to Database.query(), Database.queryWithBinds(), Database.countQuery(), Database.countQueryWithBinds(), Database.getQueryLocator(), Database.getQueryLocatorWithBinds(), Database.getCursor(), and Database.getCursorWithBinds(). It checks every Apex class and trigger in the scan, test classes and selector classes included. A call to a selector or to QRY_Builder is never flagged.
// VIOLATION -- inline SOQL
List<Account> accounts = [SELECT Id, Name FROM Account WHERE Industry = 'Tech'];
List<Account> dynamic = Database.query('SELECT Id FROM Account');
Integer total = Database.countQuery('SELECT COUNT() FROM Account');
// CORRECT -- selector
List<Account> accounts = new SEL_Accounts().findByIndustry('Tech');
// CORRECT -- the selector's query property, when no selector method fits
List<Account> accounts = new SEL_Accounts().query
.fields(new List<SObjectField>{Account.Name, Account.Industry})
.condition(Account.Industry).equals('Tech').toList();Note: Plain SOQL is only for two cases: a query the framework cannot express (raise it with the KernDX team so the gap can be closed), or code the framework does not reach. Keep that query in one place, mark it with
@SuppressWarnings('PMD.KernNoInlineSOQL'), and say in a comment why it cannot use a selector.
KernNoCoverageTheatre
The problem: a test can run production code, count toward your coverage number, and still check nothing at all. That kind of test gives false confidence: it keeps passing even after the code it "covers" breaks. The goal of this rule is to make sure a test actually verifies behaviour, not just executes lines to lift the coverage figure.
It blocks four ways a test can look thorough while proving nothing:
- A test with no
Assert.*calls at all. - An empty
catchblock that silently swallows an exception. - The legacy
Boolean exceptionThrownflag pattern. Assert.isNotNullon a record just returned byTST_Builder.build(). The builder can never return null, so this assertion is always true and proves nothing.
// VIOLATION -- no assertions
@IsTest
private static void shouldProcessRecord()
{
MyService.process(record);
}
// VIOLATION -- empty catch swallows the exception
@IsTest
private static void shouldHandleError()
{
try { MyService.process(null); }
catch(Exception e) { }
}
// VIOLATION -- Boolean exceptionThrown flag
@IsTest
private static void shouldThrowOnInvalid()
{
Boolean exceptionThrown = false;
try { MyService.process(null); }
catch(Exception e) { exceptionThrown = true; }
Assert.isTrue(exceptionThrown);
}
// VIOLATION -- Assert.isNotNull on a TST_Builder result (always non-null)
@IsTest
private static void shouldCreateAccount()
{
Account account = (Account)TST_Builder.of(Account.SObjectType).build();
Assert.isNotNull(account);
}
// CORRECT -- assert on observable behaviour
@IsTest
private static void shouldSetDefaultIndustry()
{
Account account = (Account)TST_Builder.of(Account.SObjectType).build();
Account result = (Account)new SEL_Accounts().findById(account.Id);
Assert.areEqual('Technology', result.Industry, 'Default industry should be set');
}Why this is Priority 1: these tests sail through the 100% coverage gate while verifying nothing, so they hide regressions: the test stays green even when the production code it "covers" has broken. In practice, fixing them often surfaces bugs the hollow tests were concealing.
KernCoverageExemptRequiresReason
The rule: every @SuppressWarnings('PMD.KernNoCoverageTheatre') is flagged, so a reviewer looks at it. You add that annotation when a test genuinely cannot check its result in a way KernNoCoverageTheatre recognises (for example, a platform restriction means the result cannot be read back). The scanner cannot read // comments, so it cannot judge your reason for you. The reviewer confirms two things:
- A comment just above the annotation explains why the exemption is legitimate, citing a specific platform limitation (not
tricky,hard to test,TODO,FIXMEorhack). - The suppression covers only the one method that needs it, not the whole class.
// FLAGGED -- no explanation, so the reviewer rejects it
@SuppressWarnings('PMD.KernNoCoverageTheatre')
private static void shouldEmitEvent() { ... }
// FLAGGED -- the reviewer accepts it, because the comment cites the platform limitation
// Platform event delivery is async; Test.stopTest + CURRENT_RUN
// query is the only verification available.
@SuppressWarnings('PMD.KernNoCoverageTheatre')
private static void shouldEmitPlatformEvent() { ... }In LWC code, where comments can be read, the matching ESLint rule checks the reason itself: see kerndx/no-coverage-exempt-without-reason.
Priority 3 Should Fix
Each of these rules catches a place where you used a raw Salesforce API directly when the framework offers a wrapper around it. The wrapper adds things the raw API lacks: logging, error handling, security checks, and retry logic. None of these is an emergency, so fix them as you touch the code during normal development.
KernNoDirectDML
You want to: save records safely. Writing records with a bare insert, update, delete, upsert, undelete, or merge statement (or the matching Database.* method) gives up the protections the framework adds. Route the change through DML_Builder instead, and you get an all-or-nothing transaction, consistent error handling, and the running user's permissions and record sharing enforced.
Detected patterns: insert record, update records, delete record, upsert record, undelete record, merge master duplicate, Database.insert(), Database.update(), Database.delete(), Database.upsert(), Database.undelete(), Database.merge(), Database.convertLead(), Database.emptyRecycleBin(), Database.insertAsync(), Database.updateAsync(), Database.deleteAsync(), Database.insertImmediate(), Database.updateImmediate(), Database.deleteImmediate().
// VIOLATION
insert account;
Database.update(contacts, false);
// CORRECT
DML_Builder.newTransaction()
.doInsert(account)
.doUpdate(contacts)
.execute();KernNoSystemDebug
You want to: log something and still be able to find it later. Use LOG_Builder: it saves each log as a real, queryable record (LogEntry__c, published through a platform event), so the evidence is still there next week.
Why: System.debug() writes to a debug log that expires, so the moment you need it most (after a production failure) it is gone, and you cannot search or chart it.
// VIOLATION
System.debug('Processing account: ' + account.Name);
System.debug(LoggingLevel.ERROR, 'Failed to process');
// CORRECT
LOG_Builder.build().info('Processing account: ' + account.Name).emitAt('MyClass.myMethod');
LOG_Builder.build().error('Failed to process').emitAt('MyClass.myMethod');KernNoRawHttp
You want to: call an external system and have it cope with flaky networks. Use the UTIL_HttpClient static factory methods. Building an HttpRequest or Http by hand gives you none of what the wrapper adds:
- retries;
- a circuit breaker (after repeated failures it stops calling a failing system for a cool-off, then resumes);
- logging;
- named-credential integration;
- easy mocking for tests.
Detected patterns: new HttpRequest(), new Http(), WebServiceCallout.invoke().
// VIOLATION
HttpRequest request = new HttpRequest();
request.setEndpoint('callout:PaymentGateway/charges');
request.setMethod('POST');
Http http = new Http();
HttpResponse response = http.send(request);
// CORRECT
HttpResponse response = UTIL_HttpClient.post('PaymentGateway', '/charges')
.body(chargeRequest)
.withRetry(3)
.withCircuitBreaker()
.send();KernUseSchedulerBase
You want to: schedule a job and configure it without editing code. A class that implements Schedulable directly cannot do that. Extend SCHED_Base instead and you get parameters resolved for you, configuration driven by ScheduledJob__c records (so admins can adjust it), and structured error handling.
// VIOLATION
public with sharing class MyScheduledJob implements Schedulable
{
public void execute(SchedulableContext context)
{
// job logic
}
}
// CORRECT
global inherited sharing class SCHED_MyJob extends SCHED_Base
{
public void execute(SchedulableContext context)
{
// job logic -- parameters available via getTextParameter('key') /
// getNumericParameter('key') / getBooleanParameter('key')
}
}KernNoRawSchedule
You want to: start a scheduled job through the framework so it can be monitored and configured. A direct System.schedule() call sidesteps that. Use SCHED_Base together with ScheduledJob__c records (a custom object) instead: scheduling is then driven by configuration, supports monitoring, and lets you pass parameters without touching code.
// VIOLATION
System.schedule('Nightly Sync', '0 0 0 * * ?', new MyScheduledJob());
// CORRECT -- configure via a ScheduledJob__c record
// The framework handles scheduling based on that recordKernNoRawEventPublish
You want to: publish a platform event through the framework so it is handled consistently. A direct EventBus.publish() call skips that path. For log events, use LOG_Builder; for your own domain events, use the matching framework mechanism.
// VIOLATION
LogEntryEvent__e event = new LogEntryEvent__e(Message__c = 'Error occurred');
EventBus.publish(event);
// CORRECT
LOG_Builder.build().error('Error occurred').emitAt('MyClass.myMethod');KernNoRawHttpMock
You want to: fake an HTTP response in a test without boilerplate. Writing your own HttpCalloutMock or WebServiceMock works but skips the framework's mock support. Use API_MockFactory instead: it sets up mocks consistently, configures responses for you, and plugs into the API framework's test helpers.
// VIOLATION
@IsTest
private class MyMock implements HttpCalloutMock
{
public HttpResponse respond(HttpRequest request)
{
HttpResponse response = new HttpResponse();
response.setBody('{"status": "ok"}');
response.setStatusCode(200);
return response;
}
}
// CORRECT
API_MockFactory.forService(API_SendEmail.class.getName()).body('{"messageId": "msg-12345"}').register();
// CORRECT -- error mock
API_MockFactory.registerErrorMock(API_SendEmail.class.getName());KernNoRawRestContext
You want to: handle an inbound API call with logging, error handling, and safe retries built in. Reading RestContext.request and RestContext.response directly skips all of that. Instead:
- Keep your
REST_*class thin: it should only hand off toAPI_Dispatcher.processInboundService(). - Your
API_Inboundsubclass then reads the request and writes the response through inherited properties. They automatically add logging, error handling, and idempotency (if the exact same request arrives twice, the first result is returned again rather than running the work a second time).
// VIOLATION
@RestResource(urlMapping='/v1/invoices/*')
global inherited sharing class REST_Invoices
{
@HttpGet
global static void getInvoice()
{
String invoiceId = RestContext.request.params.get('id');
RestContext.response.responseBody = Blob.valueOf('{"id": "' + invoiceId + '"}');
}
}
// CORRECT -- REST_* delegates, API_* handles logic via inherited properties
@RestResource(urlMapping='/v1/invoices/*')
global inherited sharing class REST_Invoices
{
@HttpGet
global static void getInvoice()
{
API_Dispatcher.processInboundService(API_GetInvoice.class.getName());
}
}KernNoRawEmail
You want to: send email with template handling, error handling, and logging already wired in. Using the raw Messaging API (Messaging.sendEmail(), new SingleEmailMessage(), Messaging.renderStoredEmailTemplate()) gives you none of those. Use UTIL_Email instead.
// VIOLATION
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setToAddresses(new List<String>{'user@example.com'});
email.setSubject('Notification');
email.setPlainTextBody('Hello');
Messaging.sendEmail(new List<Messaging.SingleEmailMessage>{email});
// CORRECT
UTIL_Email.sendEmail(
new List<String>{'user@example.com'},
'Notification',
'Hello',
false, // plain text
null // no attachments
);KernRestResourceNaming
The goal: keep inbound API code consistent so any developer can find the routing and the logic at a glance. This rule requires that any class annotated with @RestResource is named REST_*. A REST_* class is just a thin router that hands off to API_Dispatcher.processInboundService(); the actual business logic lives in an API_* class that extends API_Inbound.
// VIOLATION
@RestResource(urlMapping='/v1/accounts/*')
global inherited sharing class AccountService
{
// ...
}
// CORRECT
@RestResource(urlMapping='/v1/accounts/*')
global inherited sharing class REST_Accounts
{
@HttpPost
global static void createAccount()
{
API_Dispatcher.processInboundService(API_CreateAccount.class.getName());
}
}KernNoInlineDmlInTests
You want to: create test records the framework way, so they pick up the right defaults and trigger settings. Get your test records from TST_Builder.of(SObjectType).build(), which respects trigger-bypass configuration and default field providers. When the test is specifically about DML behaviour, use DML_Builder rather than a raw insert.
Why: a raw insert, update, delete, upsert, undelete, or merge statement, or the matching Database.* method, inside an @IsTest class skips the framework's test fixtures. This is the test-only version of KernNoDirectDML, and it fires only inside classes annotated @IsTest.
// VIOLATION (inside @IsTest class)
Account account = new Account(Name = 'Test');
insert account;
update account;
// CORRECT -- TST_Builder for fixtures
Account account = (Account)TST_Builder.of(Account.SObjectType).build();
// CORRECT -- DML_Builder when explicit DML is under test
DML_Builder.newTransaction().doInsert(record).execute();KernInvocableClassNeedsNoArgConstructor
You want to: Flow actions that keep working at run time. Give a class that exposes @InvocableVariable fields (Flow or Process Builder inputs and outputs) a public no-arg constructor, because the platform creates an instance of it through that constructor. The compiler will not warn you; this rule does.
The action fails the moment a Flow runs it in either of these cases:
- The class declares only argument-bearing constructors, which removes the implicit no-arg constructor.
- Its no-arg constructor is private, so Flow cannot see it.
A class that declares no constructor at all keeps the implicit no-arg constructor and is fine.
// VIOLATION -- the only constructor takes arguments
public class Request
{
@InvocableVariable(required=true)
public String recordId;
public Request(String recordId)
{
this.recordId = recordId;
}
}
// CORRECT -- explicit public no-arg constructor alongside the other one
public class Request
{
@InvocableVariable(required=true)
public String recordId;
public Request() {}
public Request(String recordId)
{
this.recordId = recordId;
}
}KernJsonReadClassNeedsJsonAccess
You want to: see your own data in the framework's messages and formulas, not blanks. Mark the class with @JsonAccess; this rule catches the missing annotation before it ships.
Why: the framework can read your DTOs (data transfer objects: small classes that carry fields and convert to and from JSON) and your formula evaluation contexts by turning them into JSON from inside its own namespace. Salesforce allows that only when your class says so with @JsonAccess.
Without it, the conversion fails quietly: merge fields that read the class can come back blank, and nothing reports an error.
It flags a class, inner classes included, that:
- extends
kern.DTO_JsonBasewithout@JsonAccess(serializable='always' deserializable='always'); - implements
kern.UTIL_FormulaFilter.INT_SObjectFormulaEvaluationContextwithout@JsonAccess(serializable='always').
Each inner class needs its own annotation. The rule also checks a class that reaches either type through a base class of yours in the same file, up to three levels down. It reads one file at a time, so it cannot follow a base class that lives in another file: annotate those subclasses as well.
// VIOLATION -- the framework reads this class as empty
public with sharing class DTO_Order extends kern.DTO_JsonBase
{
public String orderNumber;
}
// CORRECT
@JsonAccess(serializable='always' deserializable='always')
public with sharing class DTO_Order extends kern.DTO_JsonBase
{
public String orderNumber;
}Priority 5 Informational
These are good-practice suggestions that improve code quality and consistency. They are not urgent, so adopt them at your own pace as you touch existing code.
KernNoLegacyAssert
You want to: clearer test assertions with better failure messages. The older System.assert(), System.assertEquals(), and System.assertNotEquals() still work, but the modern Assert class methods (Assert.isTrue(), Assert.areEqual(), Assert.areNotEqual(), and so on) read more clearly and report failures more helpfully.
// VIOLATION
System.assertEquals('Expected', actual, 'Values should match');
System.assert(condition, 'Condition should be true');
// CORRECT
Assert.areEqual('Expected', actual, 'Values should match');
Assert.isTrue(condition, 'Condition should be true');KernUseTestBuilder
You want to: test records that stay consistent and need less upkeep. Building an SObject by hand in a test (new Account(Name = 'Test')) means every test repeats its own setup. TST_Builder.of(SObjectType).build() gives you consistent defaults, respects trigger framework configuration, and cuts the maintenance when fields change. This rule fires only inside @IsTest classes.
// VIOLATION (inside @IsTest class)
Account account = new Account(Name = 'Test Corp', Industry = 'Tech');
insert account;
// CORRECT
Account account = (Account)TST_Builder.of(Account.SObjectType)
.withOverride(Account.Industry, 'Tech').build();KernNoRawCache
You want to: cache data without worrying about partitions or what happens when the cache is full. Calling Cache.Org.* and Cache.Session.* directly leaves all of that to you. UTIL_Cache manages partitions for you, keeps working (degrading gracefully) when the cache is unavailable, and keeps your keys consistently namespaced.
// VIOLATION
Cache.Org.put('local.MyPartition.key', value);
Object cached = Cache.Org.get('local.MyPartition.key');
// CORRECT
UTIL_Cache.org().put('key', value);
Object cached = UTIL_Cache.org().get('key');KernNoRawDescribe
You want to: read object and field metadata without paying for it repeatedly. Schema.getGlobalDescribe() is slow and rebuilds its result every time you call it. UTIL_SObjectDescribe caches describe results and gives you type-safe access to fields, record types, and object metadata. Note: individual .getDescribe() calls on SObjectField and SObjectType tokens are fine and are not flagged.
// VIOLATION
Map<String, Schema.SObjectType> globalDescribe = Schema.getGlobalDescribe();
Schema.SObjectType accountType = globalDescribe.get('Account');
List<Schema.DescribeTabResult> tabs = Schema.describeTabs();
// CORRECT
UTIL_SObjectDescribe describe = UTIL_SObjectDescribe.getDescribe(Account.SObjectType);
Map<String, SObjectField> fieldMap = describe.getFieldsMap();KernNoRawTypeForName
You want to: look up an Apex class by name and have it work whether the framework runs as a managed package or in your own namespace. Use UTIL_System.getTypeForClassName(). It:
- tries your own namespace first;
- applies the package namespace prefix when needed;
- lets you point it at custom resolvers via
ClassTypeResolver__mdt.
The built-in Type.forName() does not handle that namespace resolution, so it can fail to find the class.
// VIOLATION
Type handlerType = Type.forName('TRG_SetAccountDefaults');
// CORRECT
Type handlerType = UTIL_System.getTypeForClassName('TRG_SetAccountDefaults');
// CORRECT -- with interface validation
Type handlerType = UTIL_System.getTypeForClassName('TRG_SetAccountDefaults', IF_Trigger.BeforeInsert.class);KernNoRawEnqueueJob
You want to: kick off a background job without tripping over Salesforce's limits. A direct System.enqueueJob() call gives you no protection against them. UTIL_AsynchronousJobLauncher tracks how deep the job chain has gone, watches the platform's governor limits, and falls back to another strategy when you hit the cap on queued jobs.
// VIOLATION
System.enqueueJob(new MyQueueable());
// CORRECT
UTIL_AsynchronousJobLauncher.process(itemsToProcess, new MyProcessor());MyProcessor implements kern.IF_Async.Processable. The launcher decides between a queueable and a batch based on the volume and the limits left in the transaction.
KernNoRawCrypto
You want to: hash or encrypt something with less ceremony. The raw Crypto.* API is low-level. UTIL_Crypto wraps the common operations (hashing, encryption, decryption, and key generation) in simpler calls.
// VIOLATION
Blob hash = Crypto.generateDigest('SHA-256', Blob.valueOf(input));
Blob key = Crypto.generateAesKey(256);
// CORRECT
String hash = UTIL_Crypto.generateSHA256Hash(input);
Blob key = UTIL_Crypto.generateEncryptionKey();Who this swap is for.
- Code that compiles alongside the framework source (contributions to the framework itself, and orgs running the renamed source from Path 2): use the rewrite above.
UTIL_Cryptois an in-namespace helper. - If you installed the managed package:
UTIL_Cryptobelongs to the package, so funnel everyCrypto.*call in your own code through a single reviewed crypto utility of your own rather than scattering them.
Either way, the rule points at the same thing: one audited place where cryptography happens.
KernLimitsThroughWrapper
You want to: check how much of a governor limit your code has used, or how much is left, before doing more work. Use UTIL_Limits: it gives you one object per limit with used(), maximum(), remaining(), percentUsed(), isExhausted() and isNearLimit(threshold).
Why: the built-in Limits class hands you raw numbers that you then have to compare yourself. And because every reading goes through UTIL_Limits, you have one place to read and review every limit check.
// VIOLATION
Integer queriesUsed = Limits.getQueries();
Boolean queueFull = Limits.getQueueableJobs() >= Limits.getLimitQueueableJobs();
// CORRECT
Integer queriesUsed = UTIL_Limits.soqlQueries().used();
Boolean queueFull = UTIL_Limits.queueableJobs().isExhausted();UTIL_Limits is available to your own code, so if you installed the managed package you write it as kern.UTIL_Limits. The rule stays quiet inside UTIL_Limits itself and its own test class, UTIL_Limits_TEST.
KernNoRawFeatureManagement
You want to: turn a feature on or off through configuration rather than code. The raw FeatureManagement API does not give you that. UTIL_FeatureFlag.isEnabled() reads feature flags from FeatureFlag__mdt records, caches them, and keeps flag names consistent, so admins can flip a feature without a deployment.
// VIOLATION
Boolean isEnabled = FeatureManagement.checkPermission('MyFeature');
Integer limit = FeatureManagement.checkPackageIntegerValue('MaxRetries');
// CORRECT
Boolean isEnabled = UTIL_FeatureFlag.isEnabled('MyFeature');KernNoBooleanExceptionThrown
You want to: prove a test threw the right kind of exception, with less code:
- Call
Assert.fail(...)right after the line that should throw, so the test fails if it doesn't. - Check the type with
Assert.isInstanceOfType(error, ExceptionClass.class, ...)in thecatchblock.
Why: the old Boolean exceptionThrown = false; try { ... } catch(...) { exceptionThrown = true; } pattern is wordy and only checks that some exception was thrown, not which one.
// VIOLATION
Boolean exceptionThrown = false;
try
{
MyService.processInvalid(null);
}
catch(IllegalArgumentException error)
{
exceptionThrown = true;
}
Assert.isTrue(exceptionThrown, 'Should have thrown');
// CORRECT
try
{
MyService.processInvalid(null);
Assert.fail('Should throw IllegalArgumentException');
}
catch(Exception error)
{
Assert.isInstanceOfType(error, IllegalArgumentException.class, 'Incorrect exception type');
}KernSecurityBypassCallSite
Sometimes you have a legitimate reason to turn a safety check off on purpose. KernDX supports that with a small set of deliberate opt-outs:
- On
QRY_BuilderandDML_Builder:withSystemMode()(run with object and field permission checks skipped, instead of with the current user's permissions enforced; record sharing is unaffected and keeps following the calling class) andbypassSharing(). - On
QRY_Builderonly:withoutSecurity(). - On
UTIL_ValidationRule:bypassObject(),bypassGroup(), andbypassRule(). - On
TRG_Base:bypassAction().
Each is a valid, supported call. Each is also a spot where the framework's default protections are deliberately switched off, so a reviewer should be able to see every one of them.
This rule is an inventory, not a violation. It flags each opt-out call site so that a pull request adding a new one shows up in review. To acknowledge an expected one, add @SuppressWarnings('PMD.KernSecurityBypassCallSite') or an inline // NOPMD comment with the reason. That suppression comment becomes the permanent, reviewable record that the opt-out was intended.
What the rule detects: method calls named withSystemMode, bypassSharing, withoutSecurity, bypassObject, bypassGroup, bypassRule, or bypassAction.
Why this is Priority 5: these are supported APIs, not mistakes. The rule's job is to make the full set of opt-outs visible and reviewable, not to discourage them. At runtime, the bypass-audit log records the same activity, so the deploy-time inventory and the runtime audit can be checked against each other.
PMD Rule Summary Table
All 28 PMD rules that can fire on your code, at a glance: what each detects, what to use instead, and its priority
| Rule | Detects | Use Instead | Priority |
|---|---|---|---|
KernTriggerMustDelegate | Logic in trigger body, or no dispatcher call at all | new TRG_Dispatcher().run() | 1 |
KernNoInlineSOQL | [SELECT ...], Database.query() | A selector (SEL_*), or its query property | 1 |
KernNoCoverageTheatre | Assertion-less tests, empty catches, Boolean exceptionThrown, tautological Assert.isNotNull | Assert on observable behaviour | 1 |
KernCoverageExemptRequiresReason | Every @SuppressWarnings('PMD.KernNoCoverageTheatre'), flagged for review | A comment above it citing a specific platform limitation | 1 |
KernNoDirectDML | insert/update/delete, Database.* DML | DML_Builder | 3 |
KernNoSystemDebug | System.debug() | LOG_Builder | 3 |
KernNoRawHttp | new HttpRequest(), new Http() | UTIL_HttpClient | 3 |
KernUseSchedulerBase | implements Schedulable directly | extends SCHED_Base | 3 |
KernNoRawSchedule | System.schedule() | SCHED_Base + ScheduledJob__c | 3 |
KernNoRawEventPublish | EventBus.publish() | LOG_Builder / framework events | 3 |
KernNoRawHttpMock | implements HttpCalloutMock/WebServiceMock | API_MockFactory | 3 |
KernNoRawRestContext | RestContext.request/response | API_Inbound framework | 3 |
KernNoRawEmail | Messaging.sendEmail(), new SingleEmailMessage() | UTIL_Email | 3 |
KernRestResourceNaming | @RestResource on non-REST_* class | REST_* + API_Dispatcher | 3 |
KernNoInlineDmlInTests | Raw insert/update/delete inside @IsTest classes | TST_Builder or DML_Builder | 3 |
KernInvocableClassNeedsNoArgConstructor | @InvocableVariable classes without a visible no-arg constructor | An explicit public no-arg constructor | 3 |
KernJsonReadClassNeedsJsonAccess | A kern.DTO_JsonBase subclass or formula evaluation context without @JsonAccess | @JsonAccess(serializable='always' deserializable='always') (DTO) or @JsonAccess(serializable='always') (context) | 3 |
KernNoLegacyAssert | System.assert*() | Assert.* | 5 |
KernUseTestBuilder | new Account(Name = ...) in tests | TST_Builder | 5 |
KernNoRawCache | Cache.Org.*, Cache.Session.* | UTIL_Cache | 5 |
KernNoRawDescribe | Schema.getGlobalDescribe() | UTIL_SObjectDescribe | 5 |
KernNoRawTypeForName | Type.forName() | UTIL_System.getTypeForClassName() | 5 |
KernNoRawEnqueueJob | System.enqueueJob() | UTIL_AsynchronousJobLauncher | 5 |
KernNoRawCrypto | Crypto.* | UTIL_Crypto in-namespace, or one reviewed crypto utility of your own | 5 |
KernLimitsThroughWrapper | Limits.get*() outside UTIL_Limits and its test class | UTIL_Limits, for example UTIL_Limits.soqlQueries().used() | 5 |
KernNoRawFeatureManagement | FeatureManagement.checkPermission() | UTIL_FeatureFlag.isEnabled() | 5 |
KernNoBooleanExceptionThrown | Boolean exceptionThrown try/catch pattern | Assert.fail + Assert.isInstanceOfType | 5 |
KernSecurityBypassCallSite | Security-bypass call sites (withSystemMode, bypassSharing, bypassAction, …) | Acknowledge with @SuppressWarnings/// NOPMD + reason | 5 |
ESLint Rules (LWC)
PMD reads Apex but not JavaScript, so the checks for Lightning Web Components (LWC) live in a separate ESLint plugin, eslint-plugin-kerndx. It enforces the same kinds of framework and naming conventions on the JavaScript side. The plugin contains eight rules.
kerndx/use-component-builder
You want to: stop re-writing the same plumbing in every component. Every LWC needs the same wiring: toast notifications, calls to Apex controllers, navigation, messaging, and structured logging. LightningElement (the Salesforce base class) gives you none of that, so this rule requires that your component extends ComponentBuilder(...) instead, a base class with all of it already built in.
What the rule detects:
extends LightningElementused directly.- Aliased imports. If you write
import {LightningElement as Base} from 'lwc', the rule follows the alias and still catchesextends Base.
// VIOLATION
import {LightningElement} from 'lwc';
export default class MyComponent extends LightningElement
{
// ...
}
// VIOLATION -- aliased import
import {LightningElement as Base} from 'lwc';
export default class MyComponent extends Base
{
// ...
}
// CORRECT
import {ComponentBuilder} from 'kern/componentBuilder';
import saveAccount from '@salesforce/apex/AccountController.saveAccount';
export default class MyComponent extends ComponentBuilder('notification', 'controller')
{
async handleSave()
{
await this.callControllerMethod(saveAccount, {account: this.account});
this.showSuccessToast('Saved');
}
}When to suppress: a template-only component that has no JavaScript logic needing the framework methods. In practice this is rare, because most components benefit from at least the notification module for error handling.
// eslint-disable-next-line kerndx/use-component-builder -- template-only component, no framework methods needed
export default class StaticNotice extends LightningElement {}kerndx/no-console-log
You want to: log from a component and keep the output. Native console.log() and its siblings write output you cannot filter, keep, or tie back to a single user action. ComponentBuilder gives you this.consoleLog() and this.consoleError() instead, which feed into the framework's logging so the output is searchable and kept.
What the rule detects:
console.log(),console.error(),console.warn(),console.info(),console.debug()window.console.log(),window.console.error(), etc.globalThis.console.log(),globalThis.console.error(), etc.
// VIOLATION
console.log('Account loaded:', account);
console.error('Failed to save');
window.console.log('Debug info');
// CORRECT
this.consoleLog('Account loaded:', account);
this.consoleError('Failed to save');kerndx/enforce-component-naming
The goal: keep component names consistent so anyone can tell at a glance which part of the business a component belongs to. This rule requires LWC folder names to follow a domain[Brand]FeatureVariant pattern. It is org-specific: you supply the list of domains and brands as rule options, and until you do the rule checks nothing.
What the rule detects:
- Component folder names that do not start with a recognised domain prefix.
- Component folder names longer than 40 characters.
- Folder names starting with
__are skipped (that is an internal LWC convention).
Example configuration for your org:
- Domains:
sls,ord,prd,svc,sub,mkt,cmn - Brands:
Lex,Ear - Pattern:
^(sls|ord|prd|svc|sub|mkt|cmn)(?:Lex|Ear)?[A-Z][a-zA-Z0-9]*$
// VIOLATION -- missing domain prefix
// Component folder: returnWizard/returnWizard.js
export default class ReturnWizard extends ComponentBuilder('notification') {}
// CORRECT
// Component folder: ordReturnWizard/ordReturnWizard.js
export default class OrdReturnWizard extends ComponentBuilder('notification') {}
// CORRECT -- with brand
// Component folder: svcLexWarrantyTimeline/svcLexWarrantyTimeline.js
export default class SvcLexWarrantyTimeline extends ComponentBuilder('navigation') {}Customising: The vocabulary is a rule option rather than something you edit inside the plugin, so it lives with the rest of your lint configuration:
// eslint.config.mjs
import kerndxPlugin from 'eslint-plugin-kerndx';
export default [
{
plugins: {kerndx: kerndxPlugin},
files: ['**/*.js'],
rules: {
'kerndx/enforce-component-naming': ['error', {
domains: ['sls', 'ord', 'prd', 'svc', 'sub', 'mkt', 'cmn'],
brands: ['Lex', 'Ear'],
maxLength: 40
}]
}
}
];domains is the one option you have to supply, in lowercase. brands is optional and PascalCase, and maxLength defaults to 40 if you leave it out.
Worth knowing before you turn the rule on: with no options at all it reports nothing. There is no built-in vocabulary to fall back on, which keeps the plugin useful in orgs whose conventions look nothing like this example, but it does mean an options-less 'kerndx/enforce-component-naming': 'error' line is silently doing no work.
kerndx/no-coverage-exempt-without-reason
The rule: in LWC you mark a line that genuinely cannot be tested with a // kern-coverage-exempt: comment, which removes it from the coverage count. So the comment must say exactly why, citing a specific platform limitation.
Empty, very short (under 15 characters), or hand-wavy reasons are blocked, so the comment cannot be used to quietly dodge a test you simply didn't write.
This is the JavaScript companion of the PMD KernCoverageExemptRequiresReason rule. Unlike PMD, ESLint can read comments, so it checks the reason itself.
What the rule detects:
// kern-coverage-exempt:with no reason after the colon.- A reason shorter than 15 characters.
- A blocklisted reason (case-insensitive):
hard to test,tricky,todo,fixme,later,xxx,hack.
// VIOLATION -- no reason
// kern-coverage-exempt:
throw new Error('unreachable');
// VIOLATION -- blocklisted reason
// kern-coverage-exempt: hard to test
throw new Error('unreachable');
// CORRECT -- cites a specific platform limitation
// kern-coverage-exempt: jsdom cannot trigger the real navigator.clipboard permission prompt
throw new Error('unreachable');kerndx/no-hardcoded-user-text
You want to: keep every message a user sees translatable. Text that appears in the UI (toast titles and messages, error text, display strings bound into a template) must come from a Custom Label (import myLabel from '@salesforce/label/c.MyLabel'), never a hardcoded string literal.
Why: a hardcoded string cannot be translated or overridden in the org that installs your package. This rule ships at the warn level, so it flags violations without failing the lint run.
What the rule detects:
- A string literal passed to a toast method (
showToast,showErrorToast,showSuccessToast,showWarningToast,showInfoToast,notify), set as thetitleormessageof anew ShowToastEvent({...}), or used as the message of athrow new Error(...). A literal wrapped ina || 'fallback'or a ternary is unwrapped and still caught. - A multi-word string literal that looks like display text: not a log or console argument, not a DOM or format token, and not token-shaped (an icon name like
utility:info, anslds-class, ac/module path). This catches display strings assigned to a constant or getter that feeds an HTML{binding}.
HTML templates and .js-meta.xml files are covered by the companion Node scanner (hardcoded-display-text detection), not this rule. For a justified literal (an API proper noun, a format token, developer-only text), suppress the single line with // eslint-disable-next-line kerndx/no-hardcoded-user-text and say why in the surrounding code.
// VIOLATION -- hardcoded toast text
this.showErrorToast('Something went wrong. Try again.');
// VIOLATION -- hardcoded display string feeding a template binding
get emptyStateText()
{
return 'No records to show yet.';
}
// CORRECT -- text comes from a Custom Label
import saveFailedMessage from '@salesforce/label/c.SaveFailedMessage';
this.showErrorToast(saveFailedMessage);kerndx/no-jest-theatre
This is the LWC counterpart to the Apex KernNoCoverageTheatre rule: a Jest test should prove something, not just run. A test that passes no matter what the production code does lifts your coverage number while verifying nothing. The rule blocks two such patterns:
- An assertion-less test: an
it(...)block with zeroexpect(...)calls. - A hollow
createElementassertion:expect(element).toBeTruthy()orexpect(element).toBeDefined()on a value returned bycreateElement. That only confirmscreateElementdid not throw, which proves nothing about the component.
What the rule detects:
- An
it(...)ortest(...)block whose body contains noexpect(...)calls. - An
it(...)block whose onlyexpect(...)call istoBeTruthy()ortoBeDefined()on acreateElementresult.
It applies only to files ending in .test.js or under __tests__/.
// VIOLATION -- no assertions
it('renders component', () =>
{
const element = createElement('c-my-component', {is: MyComponent});
document.body.appendChild(element);
});
// VIOLATION -- hollow assertion
it('creates element', () =>
{
const element = createElement('c-my-component', {is: MyComponent});
expect(element).toBeTruthy();
});
// CORRECT -- assert on rendered state, events, or controller calls
it('shows success toast on save', async () =>
{
const element = createElement('c-my-component', {is: MyComponent});
document.body.appendChild(element);
await element.handleSave();
expect(element.showSuccessToast).toHaveBeenCalledWith('Saved');
});kerndx/no-mutating-shared-fixture
The fix: change beforeAll to beforeEach so every test gets a fresh fixture, or move the createElement(...) call inside the it(...) block that mutates it.
The problem this prevents: a describe(...) block builds one shared DOM fixture in beforeAll(...) with createElement(...), and then several it(...) tests change that same element (via dispatchEvent, .click(), a public-API setter, or querySelector(...).click()).
Each test then inherits whatever the previous test did to it, so the tests depend on the order they run in. That hides regressions and makes a failure hard to reproduce.
It applies only to files ending in .test.js or under __tests__/.
// VIOLATION -- shared fixture mutated by multiple tests
describe('c-my-component', () =>
{
let element;
beforeAll(() =>
{
element = createElement('c-my-component', {is: MyComponent});
document.body.appendChild(element);
});
it('dispatches event on click', () =>
{
element.querySelector('button').click();
expect(element.eventDispatched).toBe(true);
});
it('shows panel on toggle', () =>
{
element.dispatchEvent(new CustomEvent('toggle'));
expect(element.panelVisible).toBe(true);
});
});
// CORRECT -- beforeEach rebuilds fixture per test
describe('c-my-component', () =>
{
let element;
beforeEach(() =>
{
element = createElement('c-my-component', {is: MyComponent});
document.body.appendChild(element);
});
});kerndx/no-jest-mock-component-module
The fix: use one of these patterns, which keep working whatever order the test files run in:
- Call
jest.spyOn(...)on the real object your test imports. - Assert what the sfdx-lwc-jest stub received, for example the event it dispatched.
- Add a
moduleNameMapperentry to your Jest configuration that points the module at a mock file.
The problem this prevents: a test calls jest.mock('c/<name>') or jest.mock('lightning/<name>') to replace a component or a base module with a fake one. Only the sfdx-lwc-jest resolver (the part of the Salesforce Jest setup that finds c/ and lightning/ modules) knows where these modules live, and that makes the fake fragile:
- Jest runs several test files one after another in the same worker. Once an earlier file loads the real module, Jest finds it under a different name, and your mock no longer replaces it.
- Often nothing fails: the test keeps passing, but it now checks a fake that your component never calls. Sometimes it fails only when the test files run in a certain order.
- Adding
{virtual: true}does not fix this.
What the rule detects: a jest.mock(...) call whose first argument starts with c/ or lightning/, written as a string or as a template literal with no ${...} parts. It reports the call with or without a factory function and with or without options.
Relative paths (such as '../spinner.html'), npm packages and @salesforce/... modules mock normally, so the rule does not report them.
It applies only to files ending in .test.js or under __tests__/.
When you turn this rule on in your own project, start it at the warn level. Your existing tests may use this pattern, and a warning flags them without failing the lint run. Fix those tests, then raise the rule to error if you want it to fail the run.
// VIOLATION -- the mock can silently stop replacing the module
jest.mock('c/utilityLogger', () => ({default: {error: jest.fn()}}), {virtual: true});
// CORRECT -- spy on the real imported object
import utilityLogger from 'c/utilityLogger';
it('logs the save failure', async () =>
{
const errorSpy = jest.spyOn(utilityLogger, 'error');
const element = createElement('c-my-component', {is: MyComponent});
document.body.appendChild(element);
await element.handleSave();
expect(errorSpy).toHaveBeenCalled();
});ESLint Setup
The ESLint configuration ships ready to go in force-app/main/default/lwc/eslint.config.mjs, so there is nothing to set up. Run the linter with:
npm run lintESLint violations appear inline in VS Code when the ESLint extension is installed. No additional IDE configuration is required beyond having the extension active; which rules the shipped config turns on is under VS Code.
Naming Validator (Flows & Custom Objects)
Flows and Custom Objects are not Apex or JavaScript, so neither PMD nor ESLint can read them. The validate-naming.js script fills that gap: it checks naming conventions for Flows (which are XML metadata) and Custom Objects (which are directory-based metadata). It is a standalone Node.js script, and you tailor it to your own org's naming convention.
How do I configure it?
You drive the script from a naming block in .kerndx/config.yml at the root of your repo. With no such file, it runs on these built-in defaults:
| Setting | Purpose | Default |
|---|---|---|
domains | Organisational domain codes | SLS, ORD, PRD, SVC, SUB, MKT, CMN |
brands | Optional brand segments | ACM, BTA |
flow_types | Flow type abbreviations | BS, AS, BD, SCR, AL, SCH, PE, SF |
length_limits | Character limits per artefact | flow: 80, custom_object: 40 |
Apex naming is enforced by the PMD ruleset and the pipeline tooling, not by this script.
Flow pattern: Domain_[Brand_]Object_Type_Action (80-character limit)
Examples: ORD_Order_BS_SetDefaults, SVC_ACM_WarrantyClaim_SCR_CreateClaim, CMN_Account_AL_SyncToExternal
Custom Object pattern: Domain_[Brand_]ObjectName__c (40-character limit)
Examples: ORD_ReturnRequest__c, SVC_ACM_WarrantyClaim__c
Running the Validator
With no argument the script scans ./force-app; give it a path to scan somewhere else. Either way, it works out for itself whether the folder uses the standard SFDX layout (force-app/main/default/) or a flat one.
node scanner/validate-naming.js
node scanner/validate-naming.js path/to/force-appThe script reports:
- How many artefacts it checked.
- Near-limit warnings (names within 5 characters of the limit), so you can rename before they overflow.
- Violations, grouped by category, each shown with the pattern it expected.
- An exit code your pipeline can act on: 0 when clean, 1 when it found violations.
How do I adapt it to my org?
Create .kerndx/config.yml at the root of your repo and describe your convention under a naming key. Nothing in scanner/ needs editing:
naming:
domains: [FIN, HR, OPS, CMN]
brands: [PRO, ENT]
flow_types: [BS, AS, BD, SCR, AL, SCH, PE, SF]
length_limits:
flow: 80
custom_object: 40How your settings combine with the defaults:
- Each list you supply replaces the matching default outright rather than adding to it, so spell out every value you want, not just the new ones. An empty
brands: []switches the brand segment off. - Keys you leave out keep their defaults.
length_limitsis the exception to the replace rule: it merges limit by limit, so you can overrideflowalone and leave the rest.
Secret Scanning
The goal: stop a hardcoded password, token, or key from ever reaching your repository. The pipeline includes a Salesforce-aware gate, kerndx secret-scan, that inspects changed files for credentials before they merge. It pairs with runtime data masking: masking keeps secrets out of your data, this gate keeps them out of your source.
The PMD and ESLint scanners only read Apex and LWC. The secret scan reads a wider set of files, because credentials slip into .env, .yml, .json, .sh, and other config files at least as often as into code. It runs over the same changed files as the rest of the pipeline.
What it detects: common credential shapes, with extra coverage for Salesforce-specific ones.
| Category | Examples |
|---|---|
| Salesforce | SFDX auth URLs (force://…), access / session tokens, OAuth refresh tokens, connected-app consumer keys and secrets |
| Cloud providers | AWS access key IDs, GitHub tokens, Slack tokens, Google API keys |
| Generic | PEM private-key blocks, JSON Web Tokens, and credential-shaped variable assignments |
How it runs. In CI (--ci) the gate is strict: any blocking finding fails the build. Run locally, it is advisory instead. It reports what it found and exits cleanly so your push still goes through, giving you a chance to catch a secret before CI does. CI is the hard gate.
Telling it a finding is safe. Sometimes the scan flags something you have confirmed is fine. You can mark it three ways (none of these turns the gate off):
- An inline
// kerndx-secret-allow: <reason>comment on the flagged line. - A path allowlist, via the
secret_scanning.ignore_globssetting in your pipeline config. - A fingerprint entry (
path:ruleId:sha8) in a.kerndxsecretsignorefile, for a one-off finding the patterns cannot otherwise tell apart.
Because every one of these carries a reason or an explicit fingerprint, each allowed exception stays visible in review.
Deploy-Time Scanners
PMD, ESLint, and the naming validator each look at source files on their own. The deploy-time scanners under scripts/ do something the others cannot: they compare your source against the actual target org. That catches misconfigurations you can only see by looking at live org state, not the files alone. Run them before any package build or deployment validation.
Access-Mode Scanner
What it guards: that every query and DML call states, out loud, whose permissions it runs under, so nothing silently runs with all security checks skipped by accident. scripts/scan-access-modes.js enforces this:
- Builders chained off
QRY_Builder.selectFrom(),DML_Builder.newTransaction(), andnew DML_Transaction()must call.withUserMode(),.withSystemMode(), or.setAccessLevel(). - Raw
Database.query(),Database.queryWithBinds(),Database.getQueryLocator(),Database.countQuery(),Search.query(), andSearch.find()must pass an explicitAccessLevelargument.
This check does not make a raw query acceptable: KernNoInlineSOQL still flags it, so a read goes through a selector.
npm run scan:access-modesThe script exits 0 on a clean run and 1 on any violation. The classes that actually implement the access-mode machinery (QRY_Builder.cls, DML_Builder.cls, and the like) are allowlisted, since the rule does not apply to the code that provides the feature.
Flow-Reference Scanner
What it guards: that every trigger configured to run a Flow points at a real, working Flow, so you don't ship a configuration record that fails at runtime. scripts/scan-flow-references.js checks each TriggerAction__mdt configuration record whose FlowName__c is filled in. For each referenced flow it verifies three things:
- It exists. The flow's API name is present in the dev org's
FlowDefinitionView. - It is active.
FlowDefinitionView.IsActive = true. - Its variables match. For non-record-triggered flows, the flow's metadata must declare an SObject variable named
recordwhoseobjectTypematches the dispatchingTriggerSetting__mdt.SObjectType__c, and which is both input and output. Configuration records for update contexts (Event = "Before Update" or "After Update") additionally require arecordPriorSObject variable.
For the existence check the scanner reads the FlowDefinitionView standard SObject; for the variable check it reads the Tooling API's Flow.Metadata. It batches both queries into a single round-trip each per scan, to keep the scan fast.
npm run scan:flow-references
npm run scan:flow-references -- --org SubscriberOrgBy default the scanner targets the org named in the KERN_DEV_ORG environment variable. Set that variable, or pass --org <alias> to point at a different scratch org, sandbox, or production org.
Permission requirement. The user running the scan in CI needs the Manage Flow permission to read FlowDefinitionView. Without it, the org returns zero rows and says nothing, which looks like "no flows" rather than "no access". The bundled Kern Administrator permission set already includes Manage Flow, so the simplest fix is to assign that permission set to the CI user:
sf org assign permset -n kern__Administrator -o YourIntegrationUserIf the CI user must stay below admin level, create a custom permission set in your org that grants only the Manage Flow user permission, and assign that instead. Runners that use a system-administrator profile (the default in pipelines that create a fresh scratch org per build) already have Manage Flow through Modify All Data.
It checks its own access first. Before checking individual records, the scanner runs SELECT COUNT() FROM FlowDefinitionView. If the count is zero and your local force-app/main/default/flows/ directory contains *.flow-meta.xml files, the scanner stops and prints:
Scanner cannot see any flows in the dev org. Either (a) the running user is missing the 'Manage Flow' user permission (assign it via the Kern Administrator permset, a sysadmin profile, or a custom permset that grants Manage Flow), or (b) the dev org has no flows deployed. Re-run after granting permissions or deploying flows.That turns the most common misconfiguration, where zero rows come back silently, into a loud error that names the fix.
What an error looks like. When it finds violations, the scanner prints one entry per affected configuration record. Each message names the record at fault, the flow at fault, and what to do about it:
| Failure | Sample message |
|---|---|
| Existence | TriggerAction 'SetAccountDefaults': flow 'Account_SetDefaults' does not exist in dev org. Either deploy the flow or remove the CMDT record. |
| Inactive | TriggerAction 'SetAccountDefaults': flow 'Account_SetDefaults' is inactive. Activate the flow or remove the CMDT record. |
| Missing variable | TriggerAction 'SetAccountDefaults': flow 'Account_SetDefaults' is missing required variable 'record: Account' (in/out). Either fix the flow declaration or correct the CMDT row's FlowName__c. |
| Wrong objectType | TriggerAction 'SetAccountDefaults': flow 'Account_SetDefaults' variable 'record' has type 'SObject/Contact' but TriggerSetting requires 'Account'. |
Umbrella Scan
If you would rather run one command than two, the scan script runs the access-mode and flow-reference scanners back to back. Use it as the single CI command, or as a quick check before you deploy locally:
npm run scanIt stops at the first scanner that fails, so the error you need to read is the last thing in the CI log. You can still run the individual scripts (scan:access-modes, scan:flow-references) when you want to target just one.
Suppression
Sometimes a flagged line is deliberate and correct. Every checker lets you suppress a rule in that case, and every one of them asks you to leave a comment saying why, so the exception stays visible to the next reviewer.
Apex (PMD)
Per-class suppression: add @SuppressWarnings to the class declaration. Every method in the class is then exempt from the named rule.
@SuppressWarnings('PMD.KernNoDirectDML')
public inherited sharing class DML_SharingProxy
{
// Framework infrastructure -- direct DML is intentional here
}Per-method suppression: add @SuppressWarnings to the method declaration. Only that one method is exempt.
public inherited sharing class MyService
{
@SuppressWarnings('PMD.KernNoInlineSOQL')
private List<Account> legacyQuery()
{
// Why: the query the framework cannot express yet, raised with the KernDX team
return [SELECT Id, Name FROM Account WHERE Legacy__c = true];
}
}Multiple rules: list the rule names, comma-separated, in a single annotation.
@SuppressWarnings('PMD.KernNoDirectDML, PMD.KernNoRawHttp')
public inherited sharing class LegacyIntegration
{
// Scheduled for refactoring in Sprint 14
}LWC (ESLint)
Per-line suppression:
// eslint-disable-next-line kerndx/use-component-builder -- template-only component
export default class StaticBanner extends LightningElement {}Per-file suppression:
/* eslint-disable kerndx/no-console-log */
// This utility file provides console wrappers for non-ComponentBuilder contextsBlock suppression:
/* eslint-disable kerndx/no-console-log */
console.log('Debugging integration');
console.error('Integration error');
/* eslint-enable kerndx/no-console-log */Flow/Object Naming
The naming validator has no inline suppression comment. You handle exceptions one of three ways instead:
- Widen the rules. Add the extra values to the
namingblock of your.kerndx/config.yml(see How do I adapt it to my org?); nothing inscanner/needs editing. - Skip a path. Change the script's directory-walking logic to exclude specific paths.
- Filter the output. In CI, pipe the output through a
grepexclusion for known exceptions.
IDE Integration
VS Code
The earlier a violation shows up, the cheaper it is to fix. Wiring the checks into your editor means you see them as you type, long before CI.
PMD (Apex): Install the Apex PMD extension from the VS Code marketplace, then add this to .vscode/settings.json:
{
"apexPMD.rulesets": [
"scanner/kerndx-pmd-ruleset.xml"
]
}If you also use org-specific naming rules:
{
"apexPMD.rulesets": [
"scanner/kerndx-pmd-ruleset.xml",
"scanner/subscriber-naming-pmd-ruleset.xml"
]
}Violations now appear inline as squiggly underlines while you type. Hover over one to see the rule name and message. The Apex PMD extension supports more than one ruleset out of the box.
ESLint (LWC): Install the ESLint extension. The configuration already lives in eslint.config.mjs, so:
- Violations from the five rules the shipped config activates appear inline automatically, with nothing else to set up:
kerndx/no-coverage-exempt-without-reason,kerndx/no-hardcoded-user-text,kerndx/no-jest-theatre,kerndx/no-mutating-shared-fixture, andkerndx/no-jest-mock-component-module. - The three
ComponentBuilder-model rules (kerndx/use-component-builder,kerndx/no-console-log,kerndx/enforce-component-naming) join them once you uncomment their block in that config, with one caveat:kerndx/enforce-component-namingreports nothing until you also give it adomainsoption.
IntelliJ / Illuminated Cloud
Illuminated Cloud (the Apex IDE plugin for IntelliJ) accepts only one PMD ruleset path, so point it at the combined ruleset that bundles both:
Settings > Illuminated Cloud > PMD > Custom Ruleset Path:
scanner/combined-pmd-ruleset.xmlThe combined file uses PMD <rule ref="..."/> elements to pull in both kerndx-pmd-ruleset.xml and subscriber-naming-pmd-ruleset.xml by reference, with no rule counted twice.
CI/CD Integration
Your editor catches violations as you type, but the build pipeline is the safety net that catches what slips through, before code reaches an org. The rulesets are standard PMD XML, so most Salesforce CI tools accept them. Here is the exact setup for the common ones, starting with the recommended Salesforce-native option.
Salesforce Code Analyzer v5 (Recommended)
SF Code Analyzer v5 (sf code-analyzer) ships with PMD 7 and accepts custom rulesets directly, so it is the simplest fit for the KernDX rules.
Configuration file (code-analyzer.yml in project root):
engines:
pmd:
custom_rulesets:
- scanner/kerndx-pmd-ruleset.xmlThe three commands below, line by line:
- A full scan with every configured rule.
- Only the KernDX framework rules (chosen by ruleset name).
- One file or folder.
Each names the configuration file with --config-file, because Code Analyzer otherwise looks for it only in the folder you run it from, and without it the KernDX rules do not load.
sf code-analyzer run --config-file code-analyzer.yml --target force-app/ --view detail
sf code-analyzer run --config-file code-analyzer.yml --rule-selector pmd:KernDXFrameworkCompliance --target force-app/ --view detail
sf code-analyzer run --config-file code-analyzer.yml --target force-app/main/default/classes/MyService.cls --view detailGitHub Actions
name: Code Quality
on: [pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install SF CLI
run: npm install -g @salesforce/cli
- name: Run Code Analyzer (Apex)
run: sf code-analyzer run --config-file code-analyzer.yml --target force-app/ --view detail
- name: Run ESLint (LWC)
run: npm ci && npm run lint
- name: Run Naming Validator
run: node scanner/validate-naming.js force-appGearset
- Go to Static Code Analysis settings
- Upload
scanner/kerndx-pmd-ruleset.xmlas a custom ruleset - Optionally upload
scanner/subscriber-naming-pmd-ruleset.xmlfor org-specific naming - Enable for deployment validations
Gearset then runs PMD against all your Apex classes and triggers during deployment validation. Both rulesets are standard PMD XML, so uploading them is all the setup there is.
Copado
- Navigate to PMD SCA Settings or Quality Gate configuration
- Add PMD rulesets as custom rulesets
- Set enforcement level per rule priority:
- Priority 1 rules: Block (fail the deployment)
- Priority 3 rules: Warn or Block (team preference)
- Priority 5 rules: Warn (informational only)
Copado accepts custom PMD rulesets directly: upload the XML files, and they run on every deployment.
AutoRABIT
- Go to Static Code Analysis > Apex PMD
- Upload PMD rulesets
- Assign to your project's analysis profile
AutoRABIT runs PMD as part of its static analysis pipeline. You upload custom rulesets through the UI, and they apply to every Apex scan in the assigned profile.
CodeScan
- Add rulesets as custom rulesets in your Quality Profile
- Activate the KernDX rules
- Set severity thresholds:
- Priority 1 = Critical
- Priority 3 = Major
- Priority 5 = Info
Legacy SF Scanner (v4)
If your team is still on the older, now-deprecated sfdx-scanner (v4), run the KernDX rules through v5 instead. If v5 is not on your computer yet, install it first with the command in the Fast Start's "Run the scanner" step, then run:
sf code-analyzer run --config-file code-analyzer.yml --rule-selector pmd:KernDXFrameworkCompliance --target force-app/ --view detailNote: SF Code Analyzer v5 (
sf code-analyzer) replacessfdx-scanner. The KernDX rules run only under v5: every v4 release bundles a PMD 7 whose Apex module is older than the 7.19.0 the KernDX rules need (see PMD Version Compatibility).
Building Org-Specific Rules
The framework rules are fixed, but your org's naming convention is your own, so the scanner lets you add naming rules of your own. The shipped subscriber-naming-pmd-ruleset.xml is a worked example you copy and adapt, in five steps.
1. Copy the template
Copy scanner/subscriber-naming-pmd-ruleset.xml to a new file (for example, scanner/myorg-naming-pmd-ruleset.xml).
2. Modify the naming patterns
Edit the XPath regular expressions to match your own convention. For example, to require FIN_, HR_, or OPS_ domain prefixes:
<rule name="MyOrgApexClassNaming"
language="apex"
message="Apex class does not follow naming: Domain_Layer_Name"
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
<priority>3</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//UserClass[
not(
matches(
@SimpleName,
'^(FIN|HR|OPS|CMN)_(SEL|TRG|FLOW|SVC|BATCH|SCHED|API|REST|DTO|CTRL|UTIL)_[A-Z][a-zA-Z0-9]+(_TEST)?$'
)
)
]
]]>
</value>
</property>
</properties>
</rule>3. Update the combined ruleset
Create or update a combined ruleset that references both the framework rules and your new org-specific ones:
<ruleset name="Framework + MyOrg Combined"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>Combined ruleset for KernDX framework + MyOrg naming.</description>
<rule ref="kerndx-pmd-ruleset.xml"/>
<rule ref="myorg-naming-pmd-ruleset.xml"/>
</ruleset>4. Customise the naming validator
Add a naming block to .kerndx/config.yml with your domains, brands and flow types, as shown in How do I adapt it to my org?.
5. Customise LWC naming
Pass your domains and brands as options to kerndx/enforce-component-naming in your ESLint config, as shown in kerndx/enforce-component-naming. The ESLint rule matches LWC folder names, so it wants lowercase domains and PascalCase brands: SLS in the YAML is sls here.
Reference: PMD 7 XPath documentation is available at pmd.github.io. The Apex AST node types used in these rules (
UserClass,UserTrigger,MethodCallExpression,NewObjectExpression,SoqlExpression, etc.) are documented in the PMD Apex language module.
Phased Adoption Strategy
If you turn every rule on at once over an existing codebase, developers face hundreds of violations on day one and tune the whole thing out. Rolling the rules out in stages avoids that. Start with the rules that matter most and add the rest as the team has capacity. This applies to any codebase written before you adopted KernDX.
Phase 1: Blockers Only
Turn on the Priority 1 rules first: KernTriggerMustDelegate, KernNoInlineSOQL, KernNoCoverageTheatre, and KernCoverageExemptRequiresReason. These catch the most serious gaps: code that steps around the trigger framework completely, code that queries outside the query layer, and tests that lift coverage without verifying anything.
Action items:
- Configure your IDE and CI with
kerndx-pmd-ruleset.xml. - Suppress the P3 and P5 rules for now, or accept them as warnings rather than blockers.
- Refactor existing triggers to use
TRG_Dispatcher. - Move inline SOQL into selectors.
- Add real assertions to any test flagged as coverage-theatre. Replace empty catches and
Boolean exceptionThrownpatterns withAssert.failplusAssert.isInstanceOfType. - Review every
@SuppressWarnings('PMD.KernNoCoverageTheatre')(Apex) and every// kern-coverage-exempt:comment (LWC), and rewrite any hand-wavy reason to cite a specific platform limitation.
Expected effort: High for initial migration (trigger refactoring), low ongoing.
Phase 2: Framework Compliance
Once the blockers are clear, add the Priority 3 rules and start moving raw platform API calls over to their framework wrappers. Each common raw call, its replacement, and the guide that explains it:
Migration checklist:
| From | To | Guide |
|---|---|---|
insert/update/delete | DML_Builder.newTransaction()...execute() | DML - Guide |
System.debug() | LOG_Builder.build()...emitAt() | Logging - Guide |
new HttpRequest() | UTIL_HttpClient.post() | Web Services - Guide |
implements Schedulable | extends SCHED_Base | Async Processing - Guide |
System.schedule() | ScheduledJob__c records | Async Processing - Guide |
EventBus.publish() | LOG_Builder / framework events | Logging - Guide |
implements HttpCalloutMock | API_MockFactory | Web Services - Guide |
RestContext.request | API_Inbound properties | Web Services - Guide |
Messaging.sendEmail() | UTIL_Email | Utilities - Guide |
Expected effort: Medium. Migrate file by file during normal development.
Phase 3: Best Practices
Finally, add the Priority 5 rules and pick up the framework utilities for caching, describe calls, type resolution, launching async jobs, cryptography, feature flags, and governor limits.
Expected effort: Low. These are small improvements your team can fold in whenever they next touch the code.
Tracking Progress
To see how the rollout is going, run the scanner and count violations by priority over time:
sf code-analyzer run --config-file code-analyzer.yml --target force-app/ --view detailRecord the violation count per priority tier in a spreadsheet or dashboard. A reasonable target: zero P1 violations right away, zero P3 within a quarter, and a steady drop in P5 from there.
PMD Version Compatibility
The KernDX PMD rulesets run on the PMD Apex module 7.19.0 or newer. Every rule is a KernDX-authored XPath rule and the rulesets reference no standard PMD categories, so they load on the PMD that Salesforce Code Analyzer bundles, with no version juggling on your side.
The pipeline still checks for you: kerndx doctor and kerndx scan read the installed PMD Apex module and warn when it sits below the floor.
The KernDX-authored rules use PMD 7's XPath rule class:
net.sourceforge.pmd.lang.rule.xpath.XPathRulePMD 6 is not supported. If your CI/CD tool pins PMD 6, or a PMD 7 whose Apex module is older than 7.19.0 (for example, legacy sfdx-scanner v4), upgrade to a tool that ships a current PMD 7, such as Salesforce Code Analyzer v5.
The rules are written for the PMD 7 XPath rule class. Swapping each <rule> element's class attribute to the PMD 6 form (net.sourceforge.pmd.lang.apex.rule.ApexXPathRule) is not enough on its own, because the XPath the rules use targets the PMD 7 Apex node model.
PMD version per CI/CD tool, and whether the ruleset works as-is
| Tool | PMD Version | Ruleset Compatible |
|---|---|---|
SF Code Analyzer v5 (sf code-analyzer) | PMD 7 | Yes, when its PMD Apex module is 7.19.0 or newer |
| VS Code Apex PMD extension | PMD 7 | Yes, when its PMD Apex module is 7.19.0 or newer |
| Illuminated Cloud (IntelliJ) | PMD 7 | Yes, when its PMD Apex module is 7.19.0 or newer |
| Gearset | PMD 7 | Yes, when its PMD Apex module is 7.19.0 or newer |
| Copado | Varies | Check the version; requires PMD Apex module 7.19.0 or newer |
| AutoRABIT | Varies | Check the version; requires PMD Apex module 7.19.0 or newer |
| CodeScan | PMD 7 | Yes, when its PMD Apex module is 7.19.0 or newer |
Legacy sfdx-scanner (v4) | PMD 7 | No: upgrade to Salesforce Code Analyzer v5 |
Related Documentation
| Document | Description |
|---|---|
| Fast Start - Code Scanning | Quick-start walkthrough for first scan setup |
| Triggers - Guide | Trigger framework and TRG_Dispatcher patterns |
| Selectors - Guide | SEL_* selectors and QRY_Builder usage |
| DML - Guide | DML_Builder transactional DML patterns |
| Logging - Guide | LOG_Builder structured logging |
| Web Services - Guide | UTIL_HttpClient, API_Inbound, API_Outbound |
| LWC - Guide | ComponentBuilder and LWC framework patterns |
| Utilities - Guide | UTIL_Cache, UTIL_Crypto, UTIL_Email, and other utilities |
| Async Processing - Guide | SCHED_Base, UTIL_AsynchronousJobLauncher |
| Security - Guide | Sharing enforcement and security patterns |
| Framework Compliance Scanner | Quick reference for scanner files and rules |