Skip to content

Commit

Permalink
scripts: compliance: add a check for missing west area maintainer enties
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
fabiobaltieri authored and mbolivar-ampere committed Sep 14, 2023
1 parent 6f0bf76 commit 183b84d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Kconfig.txt
KconfigBasic.txt
KconfigBasicNoModules.txt
MaintainersFormat.txt
ModulesMaintainers.txt
Nits.txt
Pylint.txt
YAMLLint.txt
37 changes: 37 additions & 0 deletions scripts/ci/check_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
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

Expand Down Expand Up @@ -1084,6 +1087,40 @@ def run(self):
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):
"""
Expand Down

0 comments on commit 183b84d

Please sign in to comment.