noForbiddenInclude
Flags every #include (quoted or angle-bracketed) of a library that must
never be included, in any file. A bare library name forbids the library and
all of its subfiles.
// Bad — flagged when "mp-units" is configured.
#include <mp-units/systems/si.h>
#include "mp-units/core.h"
Pattern matching
Patterns are matched against the include path exactly as written in the
source. A pattern matches if it is a directory prefix (mp-units matches
mp-units/core.h and mp-units/systems/si.h) or if it matches the whole
path as an fnmatch glob, where * also matches / (so
"*_deprecated.hpp" and "boost/hana.hpp" work too).
Configuration
Key |
Type |
Default |
Description |
|---|---|---|---|
|
list of strings |
|
Library names, directory prefixes or globs that must never be included. An empty/unset list means this check never flags anything. |
|
list of strings |
|
Including files exempt from the check. A trailing |
[cpp.ast_check_config.noForbiddenInclude]
libs = ["mp-units"]
exclude_paths = ["src/units/"]
Disabling
[cpp]
ast_check_disabled_ids = ["noForbiddenInclude"]