checks.base.Check

checks.base.Check()

Protocol defining the interface for all checks.

This protocol defines what a check must implement to be usable by pycmdcheck. Checks can be implemented by either:

  1. Inheriting from BaseCheck (recommended for most cases)
  2. Implementing this Protocol directly (for structural subtyping)

Attributes

name : str

Unique identifier for the check (e.g., “metadata”, “tests”).

description : str

Human-readable description of what the check does.

Examples

Implement a check using the protocol directly:

>>> class MyCheck:
...     name = "my_check"
...     description = "My custom check"
...
...     def run(self, package_path, config):
...         return CheckResult(
...             name=self.name,
...             status=CheckStatus.OK,
...             message="Check passed",
...         )
>>> isinstance(MyCheck(), Check)
True

Methods

Name Description
run Execute the check and return result.

run

checks.base.Check.run(package_path, config)

Execute the check and return result.

Parameters

package_path : Path

Path to the package directory to check.

config : dict[str, Any]

Configuration dictionary for this check, loaded from pyproject.toml [tool.pycmdcheck.checks.] section.

Returns

: CheckResult

A CheckResult containing the status, message, and optional details.