@@ -505,9 +505,14 @@ class KconfigCheck(ComplianceTest):
505
505
# Kconfig symbol prefix/namespace.
506
506
CONFIG_ = "CONFIG_"
507
507
508
+ # If modules should be excluded from checks.
509
+ EXCLUDE_MODULES = False
510
+
508
511
def run (self ):
509
512
kconf = self .parse_kconfig ()
510
513
514
+ blocked_module_dirs = []
515
+
511
516
self .check_top_menu_not_too_long (kconf )
512
517
self .check_no_pointless_menuconfigs (kconf )
513
518
self .check_no_undef_within_kconfig (kconf )
@@ -542,13 +547,33 @@ def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, se
542
547
modules = [name for name in os .listdir (modules_dir ) if
543
548
modules_dir / name / 'Kconfig' ]
544
549
545
- nrf_modules_dir = ZEPHYR_BASE / Path ( '../ nrf/ modules' )
550
+ nrf_modules_dir = ( Path ( ZEPHYR_BASE ) / '..' / ' nrf' / ' modules'). resolve ( )
546
551
nrf_modules = []
552
+
553
+ # This block list contains a list of upstream Zephyr modules that should not be checked
554
+ # DO NOT MERGE CHANGES TO THIS WITHOUT BUILD SYSTEM AND CODE OWNER APPROVAL!
555
+ # TODO: why is global scope of this not working
556
+ external_module_name_block_list = ['canopennode' , 'chre' , 'cmsis' , 'cmsis-dsp' , 'cmsis-nn' ,
557
+ 'cmsis_6' , 'edtt' , 'fatfs' , 'hal_st' , 'hal_tdk' ,
558
+ 'hal_wurthelektronik' , 'liblc3' , 'libmetal' , 'littlefs' ,
559
+ 'loramac-node' , 'lvgl' , 'lz4' , 'mipi-sys-t' , 'nanopb' ,
560
+ 'net-tools' , 'nrf_hw_models' , 'open-amp' , 'percepio' ,
561
+ 'picolibc' , 'segger' , 'tf-m-tests' , 'tinycrypt' ,
562
+ 'uoscore-uedhoc' , 'zscilib' ]
563
+
564
+ for module in modules :
565
+ if module in external_module_name_block_list :
566
+ self .blocked_module_dirs .append (modules_dir / module / 'Kconfig' )
567
+
547
568
if os .path .exists (nrf_modules_dir ):
548
569
nrf_modules = [name for name in os .listdir (nrf_modules_dir ) if
549
570
os .path .exists (os .path .join (nrf_modules_dir , name ,
550
571
'Kconfig' ))]
551
572
573
+ for module in nrf_modules :
574
+ if module in external_module_name_block_list :
575
+ self .blocked_module_dirs .append (nrf_modules_dir / module / 'Kconfig' )
576
+
552
577
with open (modules_file , 'r' ) as fp_module_file :
553
578
content = fp_module_file .read ()
554
579
@@ -567,6 +592,7 @@ def get_modules(self, _module_dirs_file, modules_file, sysbuild_modules_file, se
567
592
re .sub ('[^a-zA-Z0-9]' , '_' , module ).upper (),
568
593
modules_dir / module / 'Kconfig'
569
594
))
595
+
570
596
# Add NRF as static entry as workaround for ext Kconfig root support
571
597
fp_module_file .write ("ZEPHYR_NRF_KCONFIG = {}\n " .format (
572
598
nrf_modules_dir / '..' / 'Kconfig.nrf'
@@ -1050,11 +1076,34 @@ def check_no_redefined_in_defconfig(self, kconf):
1050
1076
1051
1077
def check_no_enable_in_boolean_prompt (self , kconf ):
1052
1078
# Checks that boolean's prompt does not start with "Enable...".
1079
+ # TODO: why is global scope of this not working
1080
+ external_module_name_block_list = ['canopennode' , 'chre' , 'cmsis' , 'cmsis-dsp' , 'cmsis-nn' , 'cmsis_6' , 'edtt' , 'fatfs' , 'hal_st' , 'hal_tdk' , 'hal_wurthelektronik' , 'liblc3' , 'libmetal' , 'littlefs' , 'loramac-node' , 'lvgl' , 'lz4' , 'mipi-sys-t' , 'nanopb' , 'net-tools' , 'nrf_hw_models' , 'open-amp' , 'percepio' , 'picolibc' , 'segger' , 'tf-m-tests' , 'tinycrypt' , 'uoscore-uedhoc' , 'zscilib' ]
1053
1081
1054
1082
for node in kconf .node_iter ():
1055
- # skip Kconfig nodes not in-tree (will present an absolute path)
1083
+ skip_node = False
1084
+
1085
+ # skip Kconfig nodes not in-tree when set to (will present an absolute path)
1056
1086
if os .path .isabs (node .filename ):
1057
- continue
1087
+ if self .EXCLUDE_MODULES is True :
1088
+ continue
1089
+
1090
+ normalised_file_name = Path (node .filename ).resolve ()
1091
+
1092
+ for module_name in external_module_name_block_list :
1093
+ if normalised_file_name .full_match ('**/' + module_name + '/**' ):
1094
+ skip_node = True
1095
+ break
1096
+
1097
+ if skip_node :
1098
+ continue
1099
+
1100
+ for blocked_dir in self .blocked_module_dirs :
1101
+ if normalised_file_name .match (blocked_dir ):
1102
+ skip_node = True
1103
+ break
1104
+
1105
+ if skip_node :
1106
+ continue
1058
1107
1059
1108
# 'kconfiglib' is global
1060
1109
# pylint: disable=undefined-variable
@@ -1482,6 +1531,7 @@ class KconfigBasicNoModulesCheck(KconfigBasicCheck):
1482
1531
name = "KconfigBasicNoModules"
1483
1532
path_hint = "<zephyr-base>"
1484
1533
EMPTY_FILE_CONTENTS = "# Empty\n "
1534
+ EXCLUDE_MODULES = True
1485
1535
1486
1536
def get_modules (self , module_dirs_file , modules_file , sysbuild_modules_file , settings_file ):
1487
1537
with open (module_dirs_file , 'w' ) as fp_module_file :
@@ -1574,6 +1624,7 @@ class SysbuildKconfigBasicNoModulesCheck(SysbuildKconfigCheck, KconfigBasicNoMod
1574
1624
"""
1575
1625
name = "SysbuildKconfigBasicNoModules"
1576
1626
path_hint = "<zephyr-base>"
1627
+ EXCLUDE_MODULES = True
1577
1628
1578
1629
1579
1630
class Nits (ComplianceTest ):
0 commit comments