From 4bbaa4d0d08cea603739c49e343b11d0649b0989 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Mon, 20 May 2024 19:27:44 +0200 Subject: [PATCH] ci/lint: only allow specific characters in subjects --- ci/lint-commit-msg.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ci/lint-commit-msg.py b/ci/lint-commit-msg.py index 25341b48a0..c795a98b09 100755 --- a/ci/lint-commit-msg.py +++ b/ci/lint-commit-msg.py @@ -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") def subsystem_prefix(body): - if re.search(NO_PREFIX_WHITELIST, body[0]): - return True - 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 + return (re.search(NO_PREFIX_WHITELIST, body[0]) or + re.search(r"^[\w/\.{},-]+: ", body[0])) @lint_rule("First word after : must be lower case") def description_lowercase(body):