ci/lint: only allow specific characters in subjects

This commit is contained in:
Guido Cella 2024-05-20 19:27:44 +02:00 committed by Kacper Michajłow
parent 7c4e7d8c7b
commit 4bbaa4d0d0
1 changed files with 2 additions and 9 deletions

View File

@ -62,15 +62,8 @@ NO_PREFIX_WHITELIST = r"^Revert \"(.*)\"|^Reapply \"(.*)\"|^Release [0-9]|^Updat
@lint_rule("Subject line must contain a prefix identifying the sub system") @lint_rule("Subject line must contain a prefix identifying the sub system")
def subsystem_prefix(body): def subsystem_prefix(body):
if re.search(NO_PREFIX_WHITELIST, body[0]): return (re.search(NO_PREFIX_WHITELIST, body[0]) or
return True re.search(r"^[\w/\.{},-]+: ", body[0]))
m = re.search(r"^([^:]+): ", body[0])
if not m:
return False
# a comma-separated list is okay
s = re.sub(r", ", "", m.group(1))
# but no spaces otherwise
return not " " in s
@lint_rule("First word after : must be lower case") @lint_rule("First word after : must be lower case")
def description_lowercase(body): def description_lowercase(body):