Static Checks: Update Include Order Check Rules
The including statement group order in TF-M:
Public Headers
Private Headers
<> indicates public headers.
"" indicates private headers.
Logs of include order check are printed to console.
Change-Id: I265e58fe8f09bff9cbc54dd26341939db16693c1
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
diff --git a/script/static-checks/check-include-order.py b/script/static-checks/check-include-order.py
index 7c32d65..e6dbec1 100755
--- a/script/static-checks/check-include-order.py
+++ b/script/static-checks/check-include-order.py
@@ -71,25 +71,16 @@
libc_incs = []
# First, check if all includes are in the appropriate group.
- inc_group = "System"
+ inc_group = "Public"
incs = collections.defaultdict(list)
error_msgs = []
for inc in inc_list:
- if inc[1:-1] in libc_incs:
- if inc_group != "System":
- error_msgs.append(inc[1:-1] + " should be in system group, at the top")
- elif (
- "plat/" in inc
- or "platform" in inc
- or (inc.startswith('"') and "plat" in path)
- ):
- inc_group = "Platform"
- elif inc_group in ("Project", "System"):
- inc_group = "Project"
- else:
+ if inc.startswith('"'):
+ inc_group = "Private"
+ elif inc_group == "Private":
error_msgs.append(
- inc[1:-1] + " should be in project group, after system group"
+ inc[1:-1] + " should be in public group, before private group"
)
incs[inc_group].append(inc[1:-1])