Skip to main content

vulkro-sf antipatterns

Runs the Salesforce Well-Architected anti-pattern catalog over the provided path. These rules cover architecture quality (governor-limit risk, hard-coded IDs, recursive triggers, batch context misuse) rather than security. The output is intentionally separate from vulkro-sf scan so the security report does not get diluted with maintainability findings, and so a consultancy team can run the anti-pattern pass on a different cadence from the security pass.

Synopsis

vulkro-sf antipatterns [PATH] [flags]

PATH defaults to the current directory.

Flags

FlagTypeDefaultDescription
--format <fmt>enumtextOutput format: text, sarif, json, html, junit.
--output, -o <path>pathstdoutWrite the report to a file instead of stdout.
--min-confidence <level>enummediumFloor for emitted findings: high, medium, low.
--rule <AP-NNN>string (repeatable)allRun only the specified rule(s). Pass the flag multiple times to combine.
--exclude <AP-NNN>string (repeatable)noneSkip the specified rule(s). Useful when one rule is noisy in a given codebase.

Rule list (AP-001 to AP-014)

RuleTitleWhat it flags
AP-001SOQL inside a loopAny [SELECT ...] query inside a for / while body. Governor-limit risk.
AP-002DML inside a loopinsert / update / delete / upsert operations inside a loop body.
AP-003Hard-coded record IDAn 15- or 18-character Salesforce ID embedded as a literal in Apex, LWC, Aura, or Flow.
AP-004Trigger without bulk-safetyTrigger handlers that operate on Trigger.new[0] instead of iterating the full collection.
AP-005Recursive trigger patternA trigger that performs DML on the same sObject without a static recursion guard.
AP-006Empty catch blocktry { ... } catch (Exception e) { } swallowing every error silently.
AP-007System.debug left in production codeDebug statements outside a Test.isRunningTest() guard. Performance and PII-leak risk.
AP-008Schema introspection in a loopSchema.getGlobalDescribe() or getDescribe() called per iteration.
AP-009Asynchronous chaining without governor budgetingDatabase.executeBatch or System.enqueueJob issued inside a batch class without a chain-depth guard.
AP-010Missing with sharing on a class that does DMLA non-test Apex class that issues DML and declares neither with sharing nor inherited sharing nor without sharing.
AP-011Hard-coded URL in ApexA literal https:// URL inside an Apex string concatenation (use a Named Credential or Custom Metadata Type).
AP-012Stateless Visualforce controller pattern misuseA controller declared extends PageReference or that holds large in-memory collections across requests.
AP-013Aura component with aura:method exposing system contextAn Aura controller method that does sharing-bypass work without enforcement comments.
AP-014Flow with no fault pathA screen or auto-launched Flow that calls a subflow or Apex action without a fault connector.

Examples

# Full anti-pattern pass over an SFDX project.
vulkro-sf antipatterns .

# Narrow the run to two rules - useful in a tight CI lane.
vulkro-sf antipatterns . --rule AP-001 --rule AP-002

# Exclude one noisy rule (typical when a project intentionally uses
# fault-free Flows that are guarded by a wrapper).
vulkro-sf antipatterns . --exclude AP-014

# JSON for a dashboard ingestion.
vulkro-sf antipatterns . --format json -o antipatterns.json

Exit codes

  • 0 - scan completed, no anti-patterns at or above --min-confidence.
  • 1 - scan completed, anti-patterns were reported.
  • 2 - error: bad arguments, IO failure, parse error, or internal crash.

Where to go next