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
Check base class providing |
|
|
A set of names that are allowed only in specific file paths. |
- class devops.cpp.ast.checks.name_filtered.PathException(names, paths)[source]
Bases:
objectA set of names that are allowed only in specific file paths.
- class devops.cpp.ast.checks.name_filtered.NameFilteredCheck[source]
Bases:
CheckCheck base class providing
enabled_names/disabled_namesfiltering.- 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