Skip to content

Commit ea2ab69

Browse files
tejlmandnashif
authored andcommitted
scripts: compliance.py updated to support KconfigBasic
This commit lets the Kconfig compliance check run from top of current git repo instead of only executing inside ZEPHYR_BASE. This extends the usability of the Kconfig compliance check. Together with this possibility, a KconfigBasic mode has been added which will execute the same verification for symbols in the Kconfig tree but will not check for undefined symbols outside Kconfig. This is needed as running Kconfig undef check outside the tree in non-Zephyr repos might pickup `CONFIG_` named symbols in other code. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 941af21 commit ea2ab69

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

scripts/ci/check_compliance.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,14 @@ class KconfigCheck(ComplianceTest):
225225
doc = "See https://docs.zephyrproject.org/latest/guides/kconfig/index.html for more details."
226226
path_hint = ZEPHYR_BASE
227227

228-
def run(self):
228+
def run(self, full=True):
229229
kconf = self.parse_kconfig()
230230

231231
self.check_top_menu_not_too_long(kconf)
232232
self.check_no_pointless_menuconfigs(kconf)
233233
self.check_no_undef_within_kconfig(kconf)
234-
self.check_no_undef_outside_kconfig(kconf)
234+
if full:
235+
self.check_no_undef_outside_kconfig(kconf)
235236

236237
def get_modules(self, modules_file):
237238
"""
@@ -453,7 +454,7 @@ def check_no_undef_outside_kconfig(self, kconf):
453454
# Skip doc/releases, which often references removed symbols
454455
grep_stdout = git("grep", "--line-number", "-I", "--null",
455456
"--perl-regexp", regex, "--", ":!/doc/releases",
456-
cwd=ZEPHYR_BASE)
457+
cwd=Path(GIT_TOP))
457458

458459
# splitlines() supports various line terminators
459460
for grep_line in grep_stdout.splitlines():
@@ -569,6 +570,20 @@ def get_defined_syms(kconf):
569570
"WHATEVER",
570571
}
571572

573+
class KconfigBasicCheck(KconfigCheck, ComplianceTest):
574+
"""
575+
Checks is we are introducing any new warnings/errors with Kconfig,
576+
for example using undefiend Kconfig variables.
577+
This runs the basic Kconfig test, which is checking only for undefined
578+
references inside the Kconfig tree.
579+
"""
580+
name = "KconfigBasic"
581+
doc = "See https://docs.zephyrproject.org/latest/guides/kconfig/index.html for more details."
582+
path_hint = ZEPHYR_BASE
583+
584+
def run(self):
585+
super().run(full=False)
586+
572587

573588
class Codeowners(ComplianceTest):
574589
"""

0 commit comments

Comments
 (0)