oct.linter.lint_cache module#
Purpose#
FS-510 — incremental lint cache. Content-hash keyed so unchanged files are not re-linted on subsequent runs.
Responsibilities#
Compute deterministic content hashes for source files.
Store and retrieve per-file lint results from a JSON cache file.
Invalidate entries when file content, active rules, or OCT version change.
Thread-safe read/write via
threading.Lock.
Diagnostics#
Domain: OCT-LINTER Levels:
L3 — cache hits/misses L4 — cache I/O details
Contracts#
Cache file lives at
.option_c/cache/lint-cache.json.Corrupt or missing cache file is silently replaced (no crash).
Cache is never authoritative — a
--no-cacheflag bypasses reads.
- class oct.linter.lint_cache.LintCache(cache_path: Path, oct_version: str)[source]#
Bases:
objectThread-safe, content-addressed lint result cache.
Loads from cache_path on init; call
save()to persist.- property entry_count: int#
Number of cached entries (for diagnostics).
- get(file_hash: str, active_rules_hash: str) LintCacheEntry | None[source]#
Return cached entry if content + rules match, else
None.
- put(file_hash: str, active_rules_hash: str, entry: LintCacheEntry) None[source]#
Store a lint result in the cache.
- class oct.linter.lint_cache.LintCacheEntry(content_hash: str, rule_results: dict[str, bool], json_detail: dict[str, Any], oct_version: str, timestamp: str)[source]#
Bases:
objectOne cached lint result for a single file.
- content_hash: str#
- json_detail: dict[str, Any]#
- oct_version: str#
- rule_results: dict[str, bool]#
- timestamp: str#