scripts: compliance: Fix misdetection of Kconfig choices as undefined

This commit updates the KconfigCheck to add the Kconfig symbols from
both "config" and "choice" symbol lists to the defined symbol list, as
opposed to the "config" list only, in order to prevent any references
to the choice symbols outside the Kconfig files (e.g. in documentation)
from being reported as undefined.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit is contained in:
Stephanos Ioannidis 2022-12-12 20:42:46 +09:00 committed by Stephanos Ioannidis
parent 85a7d0cc46
commit 0e5762e56e

View file

@ -397,9 +397,12 @@ class KconfigCheck(ComplianceTest):
grep_stdout = git("grep", "-I", "-h", "--perl-regexp", regex, "--",
":samples", ":tests", cwd=ZEPHYR_BASE)
# Generate combined list of configs and choices from the main Kconfig tree.
kconf_syms = kconf.unique_defined_syms + kconf.unique_choices
# Symbols from the main Kconfig tree + grepped definitions from samples
# and tests
return set([sym.name for sym in kconf.unique_defined_syms]
return set([sym.name for sym in kconf_syms]
+ re.findall(regex, grep_stdout, re.MULTILINE))