|
22 | 22 | from junitparser import TestCase, TestSuite, JUnitXml, Skipped, Error, Failure
|
23 | 23 | import magic
|
24 | 24 |
|
| 25 | +from west.manifest import Manifest |
| 26 | +from west.manifest import ManifestProject |
| 27 | + |
25 | 28 | sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
26 | 29 | from get_maintainer import Maintainers, MaintainersError
|
27 | 30 |
|
@@ -1084,6 +1087,40 @@ def run(self):
|
1084 | 1087 | except MaintainersError as ex:
|
1085 | 1088 | self.failure(f"Error parsing {file}: {ex}")
|
1086 | 1089 |
|
| 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 | + |
1087 | 1124 |
|
1088 | 1125 | class YAMLLint(ComplianceTest):
|
1089 | 1126 | """
|
|
0 commit comments