oct.linter.lint_baseline module#

Purpose#

FS-508 — lint baseline: snapshot current violations so subsequent runs can report only new vs resolved issues.

Responsibilities#

  • Save a baseline from lint results to .option_c/cache/lint-baseline.json.

  • Load an existing baseline from disk.

  • Diff current results against a baseline to find new and resolved violations.

Diagnostics#

Domain: OCT-LINTER Levels:

L3 — baseline save/load/diff

Contracts#

  • Baseline file is JSON with _schema_version, entries, metadata.

  • Corrupt or missing file returns None (no crash).

  • Violations are keyed by (path, rule) for diff stability.

class oct.linter.lint_baseline.BaselineEntry(path: str, rule: str, message: str)[source]#

Bases: object

One baselined violation.

message: str#
path: str#
rule: str#
class oct.linter.lint_baseline.LintBaseline(entries: list[BaselineEntry], oct_version: str, timestamp: str, profile: str)[source]#

Bases: object

A full baseline snapshot.

entries: list[BaselineEntry]#
oct_version: str#
profile: str#
timestamp: str#
oct.linter.lint_baseline.diff_against_baseline(results: list[dict], baseline: LintBaseline) tuple[list[tuple[str, str, str]], list[tuple[str, str, str]]][source]#

Compare current results against baseline.

Returns (new_violations, resolved_violations) where each item is (path, rule, message).

A violation is identified by its (path, rule) pair. If a (path, rule) appears in current results but not in the baseline, it is “new”. If it appears in the baseline but not in current results, it is “resolved”.

oct.linter.lint_baseline.load_baseline(baseline_path: Path) LintBaseline | None[source]#

Load a baseline from disk. Returns None on missing/corrupt file.

oct.linter.lint_baseline.save_baseline(results: list[dict], baseline_path: Path, profile: str) int[source]#

Extract violations from lint results and write to baseline_path.

Returns the number of violations saved.