config.get_check_config

config.get_check_config(config, check_name)

Get configuration for a specific check.

Extracts the configuration for a named check from the full configuration. Handles both boolean shorthand (e.g., metadata = true) and dictionary configuration (e.g., tests = { enabled = true, runner = "pytest" }).

Parameters

config : dict[str, Any]

Full pycmdcheck configuration dictionary, as returned by load_config().

check_name : str

Name of the check to get configuration for (e.g., “metadata”, “tests”, “linting”).

Returns

: dict[str, Any]

Configuration dictionary for the check, always containing an

: dict[str, Any]

“enabled” key. Additional keys depend on the check type.

Examples

Boolean config is converted to dict:

>>> config = {"checks": {"metadata": True}}
>>> get_check_config(config, "metadata")
{'enabled': True}

Dict config is passed through with enabled defaulting to True:

>>> config = {"checks": {"tests": {"runner": "pytest"}}}
>>> get_check_config(config, "tests")
{'runner': 'pytest', 'enabled': True}

Unknown checks default to enabled:

>>> config = {"checks": {}}
>>> get_check_config(config, "unknown")
{'enabled': True}