Skip to main content

Crate lanekeep_engine

Crate lanekeep_engine 

Source
Expand description

Rule execution engine for lanekeep.

Discovery, gates, parsing, query matching and handler invocation, run over a corpus.

§Why this is not in lanekeep-core

Architecture §3 places the walker in lanekeep-core. That does not work: running rules requires the sandbox, and the sandbox is built on core — putting the walker there would make lanekeep-core and lanekeep-js mutually dependent.

It cannot live in lanekeep-cli either, because lanekeep-testkit has to run rules too, and a test harness that reached into the binary crate would be a worse coupling than this one. So the walker sits above the sandbox and below both consumers.

Core keeps what it always had: the types, discovery, gates, and the ordering contract.

§The shape of a run

discover paths (sorted)
  └─> for each file, in parallel:
        path gates ──reject──> skip without reading
        read bytes
        content gates ──reject──> skip without parsing
        parse once, shared by every rule targeting the file
        for each admitted rule: match its query, invoke the handler per match
  └─> sort violations

One parse per file, not per rule. Parsing is the dominant cost, and a file with twenty applicable rules must not pay it twenty times.

Structs§

Engine
Everything a run needs, built once and shared across workers.
Outcome
What a run produced.
RuleTiming
Where a run spent its time, per rule.

Enums§

RunError
Why a run could not complete.

Functions§

any_failing
Convenience for callers that only need a default severity check.
rules_root_for
Where the rules root sits, given a project root.