equiv_receipt.report
Structured output: JSON, JSON Lines, SARIF 2.1.0, JUnit XML.
One place decides how a verdict renders, so the formats cannot drift apart.
The discipline that matters here: SARIF and JUnit have only "passed" and
"failed". UNDECIDED-AT-K is neither — it is an abstention, and it is rendered
as a failure with the reason attached. A green check mark on a question that
was not answered is exactly the confident wrong answer this package exists to
avoid.
def
verdict_meta(verdict: str) -> Tuple[bool, str, str]:
Metadata for a verdict. An unrecognised one is a failure, never a pass.
def
to_json(res: Dict, source: str = 'receipt') -> str:
def
to_jsonl(res: Dict, source: str = 'receipt') -> str:
def
to_sarif(res: Dict, source: str = 'receipt') -> str:
def
to_junit(res: Dict, source: str = 'receipt') -> str:
EMITTERS =
{'json': <function to_json>, 'jsonl': <function to_jsonl>, 'sarif': <function to_sarif>, 'junit': <function to_junit>}
def
emit(res: Dict, fmt: str, **kw) -> str: