Skip to main content

scan_cached

Function scan_cached 

Source
pub fn scan_cached(
    paths: &[PathBuf],
    rules: &[Rule],
    config: &Config,
    cache_dir: &Path,
) -> Result<ScanResult, ScanError>
Expand description

Scan with file-level caching. Files whose content hash matches a cached entry (and whose rules have not changed) return cached findings without reparsing.

cache_dir is the directory where cache files are stored, used as is (the CLI defaults it to a per-project directory under the user cache, see crate::cache::project_cache_dir). Entries are signed with the user’s CacheKey; when that key cannot be loaded or created, the scan runs uncached rather than trusting unsigned entries.

Stale entries are pruned only when every path is a directory: a file target (the pre-commit hook) is a partial scan and must keep the other entries.