oct
Loading...
Searching...
No Matches
oct.linter.lint_baseline Namespace Reference

Classes

class  BaselineEntry
class  LintBaseline

Functions

int save_baseline (list[dict] results, Path baseline_path, str profile)
LintBaseline|None load_baseline (Path baseline_path)
tuple[list[tuple[str, str, str]], list[tuple[str, str, str]]] diff_against_baseline (list[dict] results, LintBaseline baseline)
list[tuple[str, str, str]] blocking_violations (list[tuple[str, str, str]] violations, list[dict] results)

Variables

str _SCHEMA_VERSION = "1.0"

Detailed Description

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.
- Pick the blocking ones out of the new violations; only they fail
  ``--against-baseline`` (operator ruling 2026-09-28).

Diagnostics
-----------
Domain: OCT-LINTER
Levels:
    L2 - (none) the save, load and diff are reported at L3
    L3 - baseline save/load/diff
    L4 - (none)

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.

Dependencies
------------
- oct (__version__, recorded in the baseline)
- oct.core.diagnostics (_dbg structured logger)
- oct.linter.rule_registry (SEVERITY_BLOCKING)

Function Documentation

◆ blocking_violations()

list[tuple[str, str, str]] oct.linter.lint_baseline.blocking_violations ( list[tuple[str, str, str]] violations,
list[dict] results )
The *violations* whose check is blocking in *results*.

``oct lint --against-baseline`` exits 1 only for these (operator ruling
2026-09-28); a new advisory failure is listed but does not fail the
command. A check recording no severity counts as blocking, as the
compliance rule (FS-C4) treats it.

Definition at line 196 of file lint_baseline.py.

◆ diff_against_baseline()

tuple[list[tuple[str, str, str]], list[tuple[str, str, str]]] oct.linter.lint_baseline.diff_against_baseline ( list[dict] results,
LintBaseline baseline )
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".

Definition at line 149 of file lint_baseline.py.

◆ load_baseline()

LintBaseline | None oct.linter.lint_baseline.load_baseline ( Path baseline_path)
Load a baseline from disk. Returns ``None`` on missing/corrupt file.

Definition at line 119 of file lint_baseline.py.

◆ save_baseline()

int oct.linter.lint_baseline.save_baseline ( list[dict] results,
Path baseline_path,
str profile )
Extract violations from lint *results* and write to *baseline_path*.

Returns the number of violations saved.

Definition at line 74 of file lint_baseline.py.

Variable Documentation

◆ _SCHEMA_VERSION

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

Definition at line 52 of file lint_baseline.py.