Skip to main content

vulkro-sf antipatterns

Finds Salesforce Well-Architected anti-patterns (AP-NNN): governor-limit risks, hardcoded IDs, empty catch blocks and other architecture issues. These are quality findings, kept separate from the security findings of vulkro-sf scan.

vulkro-sf antipatterns .
vulkro-sf antipatterns . --format sarif > antipatterns.sarif
vulkro-sf antipatterns ./npsp --exclude-namespace=npe01,npe03,npo02
FlagWhat it does
[PATH]SFDX project or Apex source folder. Default ..
--format <table|json|sarif|junit>Output format. junit gives one test case per finding for CI runners. Default table.
--exclude-namespace <ns>Extra namespaces the project owns, beyond sfdx-project.json. Quiets AP-028 and AP-029 on merged-package projects. Repeat or comma-separate.
--compliance <hipaa|pci>Broaden the PII checks AP-015 to AP-017 with HIPAA Safe Harbor or PCI-DSS card-data identifiers. Repeat or comma-separate.
--no-cacheForce a full re-scan. Same as VULKRO_SF_NO_CACHE=1.
--cache-dir <path>Where the incremental cache lives. Default ~/.vulkro/.

For the full rule list, run vulkro-sf checks --category quality or read Well-Architected anti-patterns. In table output the governor-limit rules are tagged (Resource Optimiser).

Per-project settings (disable a detector, add owned namespaces) go in .vulkro-sf.yml.

Suppress comments​

Silence one finding without disabling its detector. The comment applies to its own line or the line directly below:

// vulkro: ignore AP-029
partnerpkg.Notifier.send(account.Id, 'created');

Use a comma list (vulkro: ignore AP-029, AP-013) or * for any rule. It works in Apex // comments and XML <!-- --> comments, case-insensitively.

Exit codes​

CodeMeaning
0No anti-patterns found.
1Anti-patterns reported.
2Error.

See also: Anti-patterns report format

Command reference​

Generated from vulkro-sf antipatterns --help (vulkro-sf 0.33.0). Run scripts/gen-docs.sh in the product repository to refresh it; do not edit this section by hand.

Find Salesforce Well-Architected anti-patterns in Apex code.

vulkro-sf antipatterns [OPTIONS] [PATH]

Arguments​

ArgumentDescription
[PATH]Path to the SFDX project or Apex source folder (defaults to the current directory) Default: ..

Options​

FlagDescription
-f, --format <FORMAT>Output format: table, json, sarif, or junit. Default: table.
--exclude-namespace <EXCLUDE_NAMESPACE>Extra Salesforce namespace(s) the project considers its own (in addition to anything sfdx-project.json declares). Use this to suppress AP-028 / AP-029 noise on merged-package projects like NPSP (npe01 / npe03 / npo02). Pass the flag multiple times or as a comma-separated list.
--compliance <COMPLIANCE>Compliance profile(s) to broaden PII detection. Recognised values: hipaa adds the 18 HIPAA Safe Harbor identifier classes (medical record number, biometric ID, device serial, IP / URL, etc.) to AP-015 / AP-016 / AP-017; pci adds PCI-DSS card-data identifier classes (PAN, CVV, expiry, cardholder name, magnetic-stripe tracks). Pass multiple times or as a comma-separated list (e.g. --compliance=hipaa,pci)
--no-cacheDisable the per-file detector cache. By default vulkro-sf caches per-file findings keyed by source SHA-256 and detector version under ~/.vulkro/sf-antipattern-cache.json; the next scan only re-runs detectors on files whose source changed. Pass this flag (or set VULKRO_SF_NO_CACHE=1) to force a full re-scan.
--cache-dir <CACHE_DIR>Override the directory the per-file detector cache lives in (default ~/.vulkro/). Mostly useful for CI runners that want the cache scoped to the workspace rather than the home dir.
-v, --verbose...Bump stderr log verbosity. -v enables debug-level tracing for the vulkro + vulkro_sf targets; -vv enables trace. Honoured only when RUST_LOG is unset (an explicit RUST_LOG always wins)
-q, --quietPrint only warnings and errors on stderr: no progress, tips or next-step hints. Results on stdout and exit codes are unchanged.
--no-colorTurn off coloured output. Colour is also off when NO_COLOR is set to a non-empty value or TERM=dumb.
-h, --helpPrint help (see a summary with '-h')
Full vulkro-sf antipatterns --help
Find Salesforce Well-Architected anti-patterns in Apex code.

Detect Salesforce Well-Architected anti-patterns in Apex source files.

Scans all .cls and .trigger files under <path> for governance and architecture-quality issues anchored to the Salesforce Well-Architected framework (pillars: Trusted/Reliable, Adaptable). This command is distinct from `scan` (which finds security vulnerabilities); anti-patterns are architecture/best-practice findings, not security bugs.

Detectors: AP-001 SOQL query inside a loop (Trusted/Reliable - governor limit) AP-002 DML operation inside a loop (Trusted/Reliable - governor limit) AP-003 Hardcoded Salesforce ID (Adaptable - org-specific value) AP-004 Empty catch block (Trusted/Reliable - silent failures)

Exit codes: 0 = no anti-patterns found; 1 = anti-patterns reported; 2 = error.

Usage: vulkro-sf antipatterns [OPTIONS] [PATH]

Arguments:
[PATH]
Path to the SFDX project or Apex source folder (defaults to the current directory)

[default: .]

Options:
-f, --format <FORMAT>
Output format: table, json, sarif, or junit

[default: table]

--exclude-namespace <EXCLUDE_NAMESPACE>
Extra Salesforce namespace(s) the project considers its own (in addition to anything sfdx-project.json declares). Use this to suppress AP-028 / AP-029 noise on merged-package projects like NPSP (npe01 / npe03 / npo02). Pass the flag multiple times or as a comma-separated list

--compliance <COMPLIANCE>
Compliance profile(s) to broaden PII detection. Recognised values: `hipaa` adds the 18 HIPAA Safe Harbor identifier classes (medical record number, biometric ID, device serial, IP / URL, etc.) to AP-015 / AP-016 / AP-017; `pci` adds PCI-DSS card-data identifier classes (PAN, CVV, expiry, cardholder name, magnetic-stripe tracks). Pass multiple times or as a comma-separated list (e.g. `--compliance=hipaa,pci`)

--no-cache
Disable the per-file detector cache. By default vulkro-sf caches per-file findings keyed by source SHA-256 and detector version under `~/.vulkro/sf-antipattern-cache.json`; the next scan only re-runs detectors on files whose source changed. Pass this flag (or set VULKRO_SF_NO_CACHE=1) to force a full re-scan

--cache-dir <CACHE_DIR>
Override the directory the per-file detector cache lives in (default `~/.vulkro/`). Mostly useful for CI runners that want the cache scoped to the workspace rather than the home dir

-v, --verbose...
Bump stderr log verbosity. `-v` enables debug-level tracing for the `vulkro` + `vulkro_sf` targets; `-vv` enables trace. Honoured only when `RUST_LOG` is unset (an explicit `RUST_LOG` always wins)

-q, --quiet
Print only warnings and errors on stderr: no progress, tips or next-step hints. Results on stdout and exit codes are unchanged

--no-color
Turn off coloured output. Colour is also off when NO_COLOR is set to a non-empty value or TERM=dumb

-h, --help
Print help (see a summary with '-h')