Skip to main content

checks.exit_code

checks.exit_code(findings, strict=False)

The exit code of babregen check for a list of findings.

Parameters

Name Type Description Default
findings list[Finding] The findings of run_checks. required
strict bool Also fail on warnings. False

Returns

Name Type Description
int int 1 if there is an error, or a warning and strict is set, else 0.

Examples

from babregen import Finding
from babregen.checks import exit_code

warning = Finding(
    "warning", "COMPACT07", "regen/units/core.calc.toml", 12, "no longer referenced"
)
print(exit_code([warning]), exit_code([warning], strict=True))
0 1