Skip to content

Commit 183b84d

Browse files
fabiobaltierimbolivar-ampere
authored andcommitted
scripts: compliance: add a check for missing west area maintainer enties
Add a check to ensure that every module has a corresponding maintainers file entry, ensure modules are not added with no recorded point of contact. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent 6f0bf76 commit 183b84d

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Kconfig.txt
7777
KconfigBasic.txt
7878
KconfigBasicNoModules.txt
7979
MaintainersFormat.txt
80+
ModulesMaintainers.txt
8081
Nits.txt
8182
Pylint.txt
8283
YAMLLint.txt

scripts/ci/check_compliance.py

+37
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
from junitparser import TestCase, TestSuite, JUnitXml, Skipped, Error, Failure
2323
import magic
2424

25+
from west.manifest import Manifest
26+
from west.manifest import ManifestProject
27+
2528
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
2629
from get_maintainer import Maintainers, MaintainersError
2730

@@ -1084,6 +1087,40 @@ def run(self):
10841087
except MaintainersError as ex:
10851088
self.failure(f"Error parsing {file}: {ex}")
10861089

1090+
class ModulesMaintainers(ComplianceTest):
1091+
"""
1092+
Check that all modules have a MAINTAINERS entry.
1093+
"""
1094+
name = "ModulesMaintainers"
1095+
doc = "Check that all modules have a MAINTAINERS entry."
1096+
path_hint = "<git-top>"
1097+
1098+
def run(self):
1099+
MAINTAINERS_FILES = ["MAINTAINERS.yml", "MAINTAINERS.yaml"]
1100+
1101+
manifest = Manifest.from_file()
1102+
1103+
maintainers_file = None
1104+
for file in MAINTAINERS_FILES:
1105+
if os.path.exists(file):
1106+
maintainers_file = file
1107+
break
1108+
if not maintainers_file:
1109+
return
1110+
1111+
maintainers = Maintainers(maintainers_file)
1112+
1113+
for project in manifest.get_projects([]):
1114+
if not manifest.is_active(project):
1115+
continue
1116+
1117+
if isinstance(project, ManifestProject):
1118+
continue
1119+
1120+
area = f"West project: {project.name}"
1121+
if area not in maintainers.areas:
1122+
self.failure(f"Missing {maintainers_file} entry for: \"{area}\"")
1123+
10871124

10881125
class YAMLLint(ComplianceTest):
10891126
"""

0 commit comments

Comments
 (0)