CheckResult

CheckResult(name, status, message, details=list(), duration=0.0)

Result of a single check.

Contains the outcome of running a check, including the status, a human-readable message, and optional details.

Attributes

name : str

Name of the check that produced this result (e.g., “metadata”).

status : CheckStatus

The status of the check (OK, WARNING, ERROR, etc.).

message : str

Human-readable message describing the result.

details : list[str]

Optional list of detailed messages providing more context.

duration : float

Time taken to run the check in seconds.

Examples

Create a successful check result:

>>> result = CheckResult(
...     name="metadata",
...     status=CheckStatus.OK,
...     message="Package metadata is valid",
... )
>>> result.status
<CheckStatus.OK: 'ok'>

Create a result with details:

>>> result = CheckResult(
...     name="linting",
...     status=CheckStatus.WARNING,
...     message="Found 3 linting issues",
...     details=["Line 10: E501 line too long", "Line 20: W503 line break"],
... )
>>> print(result)
⚠ linting: Found 3 linting issues

Methods

Name Description
to_dict Convert to dictionary for JSON serialization.

to_dict

CheckResult.to_dict()

Convert to dictionary for JSON serialization.

Returns

: dict[str, Any]

A dictionary with keys: name, status, message, details, duration.

: dict[str, Any]

The status is converted to its string value.

Examples

>>> result = CheckResult("test", CheckStatus.OK, "Passed")
>>> result.to_dict()
{'name': 'test', 'status': 'ok', 'message': 'Passed', 'details': [], 'duration': 0.0}