from babregen import Finding
finding = Finding(
"error", "COMPILE02", "src/samplepkg/core/bad.py", 1, "forbidden import"
)
print(finding.format())src/samplepkg/core/bad.py:1: error COMPILE02 forbidden import
One result of a check.
| Name | Type | Description |
|---|---|---|
| level | str | "error" (fails the check) or "warning". |
| id | str | Stable ID, named after a primitive, for example "COMPILE02". The levels and conditions are in babregen.checks.CHECKS. |
| path | str | Repository-relative POSIX path of the file the finding is about: a record, a source file, an evaluation file or a run record. |
| line | int | None | 1-based line in path, or None when the check cannot tell. |
| message | str | What is wrong and, where possible, how to fix it. It names the unit where path does not. |
| suggestion | str | None | A similar valid name when the finding is about a name that matches nothing (EVAL03, PROV01, PROV02, COMPILE06, COMPILE08) and a close one exists, else None. |
All six fields take part in equality.
| Name | Description |
|---|---|
| format | Render the finding as one line for a terminal. |
Render the finding as one line for a terminal.
| Name | Type | Description |
|---|---|---|
| str | str | {path}:{line}: {level} {id} {message}, or {path}: {level} {id} {message} when line is None. The level is lower case and nothing is padded. A finding with a suggestion ends with ; a similar name exists: 'X'. |