Computes coverage for catalog, prints the audit table, and enforces the gate.
raises) or
“reject-undocumented” (enforces threshold). Sourced from
GlobalConfig.coverage_mode.
report_format: Output format for the coverage report. One of “markdown”,
“sarif”, or “codeclimate”.
Raises:
ValueError: when threshold is not within the valid 0.0-1.0 fraction
range. This defense-in-depth check protects library callers who
invoke apply_coverage_gate() directly, bypassing the CLI
boundary check and the GlobalConfig.coverage_threshold Field
constraint that already guards config-file-sourced values.
CoverageGateError: when mode == “reject-undocumented” and coverage falls
below threshold. Callers that need a specific process exit
code (e.g. a future CLI audit handler) should catch
CoverageGateError and translate it themselves.
Returns:
The computed CoverageReport, if the gate passes (or mode is
Methods
apply_coverage_gate
apply_coverage_gate(catalog: ProjectCatalog, threshold: float, mode: str, report_format: str, extra_findings: Optional]) -> CoverageReport
Computes coverage for catalog, prints the audit table, and enforces the gate.
raises) or
“reject-undocumented” (enforces threshold). Sourced from
GlobalConfig.coverage_mode.
report_format: Output format for the coverage report. One of “markdown”,
“sarif”, or “codeclimate”.
Raises:
ValueError: when threshold is not within the valid 0.0-1.0 fraction
range. This defense-in-depth check protects library callers who
invoke apply_coverage_gate() directly, bypassing the CLI
boundary check and the GlobalConfig.coverage_threshold Field
constraint that already guards config-file-sourced values.
CoverageGateError: when mode == “reject-undocumented” and coverage falls
below threshold. Callers that need a specific process exit
code (e.g. a future CLI audit handler) should catch
CoverageGateError and translate it themselves.
Returns:
The computed CoverageReport, if the gate passes (or mode is
| Parameter | Type | Description |
|---|---|---|
| catalog | ProjectCatalog | The parsed project catalog to compute coverage over. |
| threshold | float | Fraction (e.g. 0.98 for 98%) below which the gate fails |
| mode | str | “allow-undocumented” (informational only, never |
| report_format | str | |
| extra_findings | Optional] |
Generated with Flude
Copyright © 2026