prereg_seal.report
Structured output: JSON, JSON Lines, SARIF 2.1.0, JUnit XML.
One place decides how an outcome renders, so the formats cannot drift apart.
Two things this package has to say that a boolean cannot. A missing seal is
not a pass — an unsealed check establishes nothing, and reporting it green is
worse than reporting nothing. And an abstained anchor (UNANCHORED) is not a
failure of the seal; it means the publication could not be checked. Neither
SARIF nor JUnit has a state for either, so both are rendered as failures with
the reason attached.
def
outcome_meta(outcome: str) -> Tuple[bool, str, str]:
Metadata for an outcome. An unrecognised one is a failure, never a pass.
def
to_json(res: Dict, source: str = 'spec') -> str:
def
to_jsonl(res: Dict, source: str = 'spec') -> str:
def
to_sarif(res: Dict, source: str = 'spec') -> str:
def
to_junit(res: Dict, source: str = 'spec') -> 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: