Skip to content

Commit

Permalink
gitlint: do not allow treewide as an area in commit messages
Browse files Browse the repository at this point in the history
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 <anas.nashif@intel.com>
  • Loading branch information
nashif authored and aescolar committed Apr 10, 2024
1 parent b9f3d68 commit 66af7a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions scripts/ci/twister_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ scripts/checkpatch.pl
scripts/ci/pylintrc
scripts/footprint/*
scripts/set_assignees.py
scripts/gitlint/zephyr_commit_rules.py
2 changes: 1 addition & 1 deletion scripts/gitlint/zephyr_commit_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down

0 comments on commit 66af7a6

Please sign in to comment.