Miscellaneous-NoIncludePaths

Avoid using forbidden kinds of paths in #include

Required inputs: IR

Forbid including from paths of a some kind, like absolute paths or certain relative parent- or subpaths.
Example
#include "header.h"          // ok
#include "/include/header.h" // bad - if not "allow_absolute_paths"
#include "./header.h"        // bad - if not "allow_same_directory"
#include "../header.h"       // bad - if not "allow_upward_paths"
#include "include/header.h"  // bad - if not "allow_downward_paths"

Possible Messages

Key

Text

Severity

Disabled

include_with_forbidden_path_kind

Avoid using forbidden kinds of paths in #include.

None

False

Options

allow_absolute_paths

allow_absolute_paths : bool = False

Suppresses messages on absolute paths in #includes.
 

allow_downward_paths

allow_downward_paths : bool = False

Suppresses messages on #include "a/b/c" cases.
 

allow_same_directory

allow_same_directory : bool = False

Suppresses messages on #include "./file" cases.
 

allow_upward_paths

allow_upward_paths : bool = False

Suppresses messages on #include "../a" cases.
 

use_scanner

use_scanner : bool = False

Deprecated. This option no longer has any effect; the IR now contains enough information to accurately implement this rule without using the scanner.