Skip to main content

explain.Explanation

explain.Explanation(file, wrong, right, fix, setup=(), missing=False)

The explanation of one check ID: a wrong fragment, the corrected one and the fix.

The fragments are written against the sample repository. Replacing right by wrong in file of the sample repository, after the edits of setup, gives a repository that reports the ID; right is what the file holds when it does not.

Attributes

Name Type Description
file str The repository-relative path of the file that holds the fragments.
wrong str The fragment that triggers the check.
right str The corrected fragment. It occurs in file of the sample repository after the edits of setup.
fix str What the usual fix is, in a sentence or two.
setup tuple[tuple[str, str, str], …] Edits that the sample repository needs before the fragments apply, as (path, old, new); an empty old writes the whole file path as new. They are the same for the wrong and the right state.
missing bool Whether the wrong state is that file does not exist (then wrong only says so).

Examples

from babregen.explain import EXPLANATIONS

print(EXPLANATIONS["EVAL03"].wrong)
evaluations = ["test_ad"]