Option C Tools
Loading...
Searching...
No Matches
oct.linter.lint_cache Namespace Reference

Classes

class  LintCacheEntry
class  LintCache

Functions

str content_hash (str text)
str rules_hash (dict[str, bool] active_rules)

Variables

str _SCHEMA_VERSION = "1.0"

Detailed Description

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-cache`` flag bypasses reads.

Function Documentation

◆ content_hash()

str oct.linter.lint_cache.content_hash ( str text)
Return a SHA-256 hex digest of *text*.

Definition at line 45 of file lint_cache.py.

◆ rules_hash()

str oct.linter.lint_cache.rules_hash ( dict[str, bool] active_rules)
Return a SHA-256 hex digest of the sorted active-rules dict.

Definition at line 50 of file lint_cache.py.

Variable Documentation

◆ _SCHEMA_VERSION

str oct.linter.lint_cache._SCHEMA_VERSION = "1.0"
protected

Definition at line 42 of file lint_cache.py.