Skip to main content

explain.explain_text

explain.explain_text(check_id)

The explanation of one check ID, as babregen explain prints it.

The text names the level and the condition of the check, a fragment that triggers it, the corrected fragment and the usual fix. The ID is accepted in lower case.

Parameters

Name Type Description Default
check_id str A check ID, for example "EVAL03". required

Returns

Name Type Description
str str The text, ending in a line feed.

Raises

Name Type Description
SpecError If the ID is not one of babregen.checks.CHECKS; the error carries a similar ID when there is one.

Examples

from babregen.explain import explain_text

print(explain_text("eval03"))
EVAL03 (error): an evaluation named by an intent item is not defined in the unit's evaluation files

Wrong, in regen/units/core.calc.toml:

    evaluations = ["test_ad"]

Right:

    evaluations = ["test_add"]

Fix: Correct the name: the finding names a similar one when it exists. When no test has that name, the evaluation is missing: write the test, then name it.