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. - Python
Config - 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). - Python
Coverage [python].coverage. A partial override —#[serde(default)]fills any missing field fromPythonCoverage::default, so a table that sets only one threshold keeps our defaults for the rest (#216);deny_unknown_fieldsstill rejects a typo’d key.- Rust
Config - The
[rust]table. - Rust
Coverage [rust].coverage. A partial override —#[serde(default)]fills any missing field fromRustCoverage::default(lines = 100, everything elseNone), so a table that sets onlyregionskeepslines = 100(#216);deny_unknown_fieldsstill rejects a typo’d key. Three opt-in floors sit alongsidelines(#267):regions(a Rust-only sub-line metric),functions(the export’s functions total, stable toolchain), andbranch(adds--branchto the run, which instruments only on a nightly toolchain).- Type
Script Config - The
[typescript]table. - Type
Script Coverage [typescript].coverage. A partial override —#[serde(default)]fills any missing field fromTypeScriptCoverage::default, so a table that sets only one of the four metrics keeps our defaults for the rest (#216);deny_unknown_fieldsstill rejects a typo’d key.
Enums§
- Line
Scope - What an exemption lifts for one file (#226): the whole file, or only specific lines.
- Line
Spec - One element of an exemption’s
lineslist (#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
pathinto aConfig, validating it on the way. - resolve_
exempt - Resolve the set of exempt paths for
rulefromexemptions, validating that each still points to a file underroot. - resolve_
exempt_ scoped - Resolve the per-file exempt scope for
rule(#226) — whole-file or line-scoped.