scanFile()
scanFile(filePath, root, options): Promise<{ relPath: string; result: FileScanResult; }>
Defined in: workspace.ts:184
Scans a single file with optional caching and presentation filtering.
Invariants:
- Binary files are skipped and return an empty result.
- When caching is enabled, baseline scan always runs with
minSeverity: "LOW"and inline ignores enabled. - Presentation filtering is applied after cache retrieval.
- Cache writes are fire-and-forget and never block execution.
Returns
nullif file is binary or scan fails.
Fix Semantics:
- When
shouldApplyFixesis enabled, fixes are applied immediately after scanning and cache is updated.
Parameters
filePath
string
root
string
options
| Name | Type | Description |
|---|---|---|
baselineMinSeverity | Severity | - |
cache | CacheManager | null | - |
fileCount? | number | - |
minSeverity | Severity | - |
noInlineIgnore | boolean | - |
shouldApplyFixes? | boolean | - |
write? | boolean | - |
Returns
Promise<{ relPath: string; result: FileScanResult; }>