Skip to main content

Module config

Module config 

Source
Expand description

The testing-conventions config schema and loader.

One config file is read into the in-memory Config below. The loader parses and validates the config itself (the “self-guard” from issue #12): a malformed or unknown-key config is an error, never a silently-accepted default. Validation also covers the per-file Exemption list (issue #32): every exemption must name at least one rule and carry a non-empty reason.

Structs§

Config
A fully-parsed testing-conventions config file.
Exemption
One auditable per-file exemption — a [[<language>.exempt]] entry.
PythonConfig
The [python] table. Both keys are optional, so a repo can configure just coverage, just exemptions, or both. Default (no coverage table, no exemptions) backs the zero-config path: an absent [python] table means the rule runs against the default floor with nothing exempt (#80).
PythonCoverage
[python].coverage. A partial override#[serde(default)] fills any missing field from PythonCoverage::default, so a table that sets only one threshold keeps our defaults for the rest (#216); deny_unknown_fields still rejects a typo’d key.
RustConfig
The [rust] table.
RustCoverage
[rust].coverage. A partial override#[serde(default)] fills any missing field from RustCoverage::default (lines = 100, everything else None), so a table that sets only regions keeps lines = 100 (#216); deny_unknown_fields still rejects a typo’d key. Three opt-in floors sit alongside lines (#267): regions (a Rust-only sub-line metric), functions (the export’s functions total, stable toolchain), and branch (adds --branch to the run, which instruments only on a nightly toolchain).
TypeScriptConfig
The [typescript] table.
TypeScriptCoverage
[typescript].coverage. A partial override#[serde(default)] fills any missing field from TypeScriptCoverage::default, so a table that sets only one of the four metrics keeps our defaults for the rest (#216); deny_unknown_fields still rejects a typo’d key.

Enums§

LineScope
What an exemption lifts for one file (#226): the whole file, or only specific lines.
LineSpec
One element of an exemption’s lines list (#226): a single 1-based line, or an inclusive "start-end" range.
Rule
A rule a file can be exempted from (issue #32).

Functions§

load_config
Read one config file at path into a Config, validating it on the way.
resolve_exempt
Resolve the set of exempt paths for rule from exemptions, validating that each still points to a file under root.
resolve_exempt_scoped
Resolve the per-file exempt scope for rule (#226) — whole-file or line-scoped.