devops.cpp.ast.registry

Registry of active AST checks.

Add a new check here after implementing it as a Check subclass under devops.cpp.ast.checks.

Functions

configure_checks(checks[, check_config])

Apply per-check configuration and return a new list of checks.

select_checks(checks, *[, enabled_ids, ...])

Filter checks by id using an optional allow/deny list.

devops.cpp.ast.registry.select_checks(checks, *, enabled_ids=None, disabled_ids=None)[source]

Filter checks by id using an optional allow/deny list.

An empty (or omitted) enabled_ids means “no allowlist restriction” — every check runs except those in disabled_ids. A non-empty enabled_ids acts as an allowlist: only those checks run, and disabled_ids is still subtracted from that set.

Parameters:
  • checks (list[Check]) – The checks to filter, typically ALL_CHECKS.

  • enabled_ids (list[str] | None) – If non-empty, only checks whose .id is in this list are kept.

  • disabled_ids (list[str] | None) – Checks whose .id is in this list are always dropped.

Returns:

list[Check] – The filtered list of checks.

Raises:

ConfigError – If any id in enabled_ids/disabled_ids matches no known check — typically a typo, or a check id that only exists in a newer devops version than the one actually installed.

Return type:

list[Check]

devops.cpp.ast.registry.configure_checks(checks, check_config=None)[source]

Apply per-check configuration and return a new list of checks.

Each check whose .id appears in check_config receives a shallow copy so that the shared ALL_CHECKS singletons are never mutated. The generic exclude_paths key (path patterns of files the check must not run on) is handled here for every check; the rest of the table goes to the check’s own configure().

Parameters:
  • checks (list[Check]) – The checks to configure, typically the result of select_checks.

  • check_config (dict[str, dict] | None) – Mapping of check id → raw config dict (the sub-table from cpp.ast_check_config.<id> in the project TOML). Unknown ids are silently ignored.

Returns:

list[Check] – A new list where configured checks are shallow-copied instances.

Return type:

list[Check]