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 <fabiobaltieri@google.com>
This commit is contained in:
parent
6f0bf76086
commit
183b84d0e2
2 changed files with 38 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -77,6 +77,7 @@ Kconfig.txt
|
|||
KconfigBasic.txt
|
||||
KconfigBasicNoModules.txt
|
||||
MaintainersFormat.txt
|
||||
ModulesMaintainers.txt
|
||||
Nits.txt
|
||||
Pylint.txt
|
||||
YAMLLint.txt
|
||||
|
|
|
@ -22,6 +22,9 @@ from yamllint import config, linter
|
|||
from junitparser import TestCase, TestSuite, JUnitXml, Skipped, Error, Failure
|
||||
import magic
|
||||
|
||||
from west.manifest import Manifest
|
||||
from west.manifest import ManifestProject
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
from get_maintainer import Maintainers, MaintainersError
|
||||
|
||||
|
@ -1084,6 +1087,40 @@ class MaintainersFormat(ComplianceTest):
|
|||
except MaintainersError as ex:
|
||||
self.failure(f"Error parsing {file}: {ex}")
|
||||
|
||||
class ModulesMaintainers(ComplianceTest):
|
||||
"""
|
||||
Check that all modules have a MAINTAINERS entry.
|
||||
"""
|
||||
name = "ModulesMaintainers"
|
||||
doc = "Check that all modules have a MAINTAINERS entry."
|
||||
path_hint = "<git-top>"
|
||||
|
||||
def run(self):
|
||||
MAINTAINERS_FILES = ["MAINTAINERS.yml", "MAINTAINERS.yaml"]
|
||||
|
||||
manifest = Manifest.from_file()
|
||||
|
||||
maintainers_file = None
|
||||
for file in MAINTAINERS_FILES:
|
||||
if os.path.exists(file):
|
||||
maintainers_file = file
|
||||
break
|
||||
if not maintainers_file:
|
||||
return
|
||||
|
||||
maintainers = Maintainers(maintainers_file)
|
||||
|
||||
for project in manifest.get_projects([]):
|
||||
if not manifest.is_active(project):
|
||||
continue
|
||||
|
||||
if isinstance(project, ManifestProject):
|
||||
continue
|
||||
|
||||
area = f"West project: {project.name}"
|
||||
if area not in maintainers.areas:
|
||||
self.failure(f"Missing {maintainers_file} entry for: \"{area}\"")
|
||||
|
||||
|
||||
class YAMLLint(ComplianceTest):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue