devops.cpp.ast.checks.name_filtered

Shared base for checks that can be narrowed by name via TOML.

A NameFilteredCheck reads two optional lists from its [cpp.ast_check_config.<id>] table:

enabled_names  = ["std"]              # allowlist; empty/unset = everything
disabled_names = ["std::literals"]    # always skipped, wins over enabled_names

Names are matched exactly against the qualified name as written in the source; a leading :: is ignored.

Per-name path exceptions allow specific names to pass through in designated files or directories. Each entry names the exempt names and the file-path patterns where they are allowed:

[[cpp.ast_check_config.<id>.path_exceptions]]
names = ["rad"]
paths = ["src/units/", "include/units/"]

Patterns ending with / match any file whose path starts with that prefix (recursively). Any other pattern is matched using fnmatch rules (* matches within a directory component, ? matches one character).

Classes

NameFilteredCheck()

Check base class providing enabled_names / disabled_names filtering.

PathException(names, paths)

A set of names that are allowed only in specific file paths.

class devops.cpp.ast.checks.name_filtered.PathException(names, paths)[source]

Bases: object

A set of names that are allowed only in specific file paths.

Parameters:
names: frozenset[str]
paths: tuple[str, ...]
class devops.cpp.ast.checks.name_filtered.NameFilteredCheck[source]

Bases: Check

Check base class providing enabled_names / disabled_names filtering.

enabled_names: frozenset[str]
disabled_names: frozenset[str]
path_exceptions: list[PathException]
configure(config)[source]

Load the name allow/deny lists from the check’s TOML config block.

Parameters:

config (dict) – Expected shape: {"enabled_names": ["std"], "disabled_names": ["std::literals"], "path_exceptions": [{"names": ["rad"], "paths": ["src/units/"]}]}. All keys are optional.

Raises:

ConfigError – If any key is present but has an invalid type.

Return type:

None