results.most_severe

results.most_severe(findings)

Return the most severe status among findings.

An error outranks a warning, which outranks a note. This is the status of a result that carries these findings.

Parameters

findings : Iterable[Finding]

The findings of one check.

Returns

: CheckStatus

ERROR, WARNING or NOTE, or OK when there are no findings.

Examples

>>> most_severe(
...     [
...         Finding("changelog.missing", "No changelog found"),
...         Finding(
...             "metadata.missing-required",
...             "Missing required fields: version",
...             CheckStatus.ERROR,
...         ),
...     ]
... )
<CheckStatus.ERROR: 'error'>
>>> most_severe([])
<CheckStatus.OK: 'ok'>