Skip to main content

Module cache

Module cache 

Source

Structs§

CacheEntry
What one scanned file leaves in the cache: its findings, the symbols it contributes to the cross-file index, and the imports it contributes to the resolution pass, so a cache hit feeds both project-wide passes without re-parsing the file.
CacheKey
Secret key signing every cache entry with HMAC-SHA256, so an entry written without the key (a committed or planted file) is never trusted.
CacheStore
A file-based cache store for scan findings. Every entry is signed with the store’s CacheKey; an unsigned or tampered entry reads as a miss.

Enums§

CacheError

Functions§

ensure_gitignored_dir
Create dir (and parents) if missing and drop a .gitignore that ignores the entire cache directory. Idempotent.
file_content_hash
Compute the SHA256 hash of a file’s content.
project_cache_dir
Default scan cache directory for the project rooted at project_root: a subdirectory of user_cache_dir named after a hash of the canonical root, so two projects never share (nor prune) each other’s entries.
rules_hash
Compute a stable hash of the active rules by sorting them by id and hashing each rule’s serialized body along with the scanner’s own version.
sha256_hex
Hex-encoded SHA256 of data. Shared by every cache key in the workspace.
user_cache_dir
Root of every slopguard cache for the current user ($XDG_CACHE_HOME/slopguard or the platform equivalent). It lives outside any scanned repository, so a repository cannot ship cache entries of its own.