From 950c094e4ef26e0d212b2ce9705ca2ac53899205 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 16 Mar 2026 00:02:41 +0800 Subject: [PATCH] feat(ci): add rule to prevent inclusion of in soc *reg.h headers --- .../no_stdint_include_in_soc_reg_header.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tools/ci/sg_rules/no_stdint_include_in_soc_reg_header.yml diff --git a/tools/ci/sg_rules/no_stdint_include_in_soc_reg_header.yml b/tools/ci/sg_rules/no_stdint_include_in_soc_reg_header.yml new file mode 100644 index 0000000000..f9e29de0b2 --- /dev/null +++ b/tools/ci/sg_rules/no_stdint_include_in_soc_reg_header.yml @@ -0,0 +1,17 @@ +# Refer to https://ast-grep.github.io/guide/rule-config.html for Rule Essentials +id: no-stdint-include-in-soc-reg-header +message: Don't include in soc *reg.h headers +severity: error # error, warning, info, hint +note: Please remove '#include ' from soc *reg.h headers +language: C +files: + - "components/soc/**/*reg.h" +rule: + kind: preproc_include + has: + field: path + pattern: $N +constraints: + N: + regex: '^["<]stdint\.h[">]' # match "stdint.h" or +fix: ''