From 66af7a6881bda5622f7d8e9ee6ee9a51c70b3d28 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 4 Apr 2024 09:03:31 -0400 Subject: [PATCH] gitlint: do not allow treewide as an area in commit messages Treewide changes touching a single area or topic should have the area/subsystem at the start of the commit message. Treewide is very ambigous. Signed-off-by: Anas Nashif --- .gitlint | 2 +- scripts/ci/twister_ignore.txt | 1 + scripts/gitlint/zephyr_commit_rules.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlint b/.gitlint index de5285527c..e83edce6b6 100644 --- a/.gitlint +++ b/.gitlint @@ -26,7 +26,7 @@ extra-path=scripts/gitlint # max-line-count=200 [title-starts-with-subsystem] -regex = ^(?!subsys:)(([^:]+):)(\s([^:]+):)*\s(.+)$ +regex = ^(?!subsys:)(?!treewide:)(([^:]+):)(\s([^:]+):)*\s(.+)$ [title-must-not-contain-word] # Comma-separated list of words that should not occur in the title. Matching is case diff --git a/scripts/ci/twister_ignore.txt b/scripts/ci/twister_ignore.txt index 8b1ac2f6c3..8db6878be3 100644 --- a/scripts/ci/twister_ignore.txt +++ b/scripts/ci/twister_ignore.txt @@ -45,3 +45,4 @@ scripts/checkpatch.pl scripts/ci/pylintrc scripts/footprint/* scripts/set_assignees.py +scripts/gitlint/zephyr_commit_rules.py diff --git a/scripts/gitlint/zephyr_commit_rules.py b/scripts/gitlint/zephyr_commit_rules.py index ea31c6737f..a2c9cd3cb7 100644 --- a/scripts/gitlint/zephyr_commit_rules.py +++ b/scripts/gitlint/zephyr_commit_rules.py @@ -95,7 +95,7 @@ class TitleStartsWithSubsystem(LineRule): def validate(self, title, _commit): regex = self.options['regex'].value pattern = re.compile(regex, re.UNICODE) - violation_message = "Commit title does not follow [subsystem]: [subject] (and should not start with literal subsys:)" + violation_message = "Commit title does not follow [subsystem]: [subject] (and should not start with literal subsys or treewide)" if not pattern.search(title): return [RuleViolation(self.id, violation_message, title)]