Skip to content

Commit eac402a

Browse files
peterbarkerclaude
andcommitted
Tools: check_branch_conventions: reject blacklisted subsystem prefixes
Adds check_good_commit_subsystem() which fails if any commit in the PR uses a prefix from BLACKLISTED_PREFIXES (currently just "DEBUG"). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 99b5d5b commit eac402a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Tools/scripts/check_branch_conventions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525

2626
DOCS_URL = "https://ardupilot.org/dev/docs/submitting-patches-back-to-master.html"
2727
MAX_SUBJECT_LEN = 160
28+
BLACKLISTED_PREFIXES = {
29+
"DEBUG",
30+
"DRAFT",
31+
"TEMP",
32+
"TMP",
33+
"WIP",
34+
}
2835
# spaces and quotes allowed to support Revert commits e.g. 'Revert "AP_Periph: ...'
2936
PREFIX_RE = re.compile(r'^[-A-Za-z0-9._/" ]+$')
3037

@@ -97,6 +104,10 @@ def check_commit_messages(self, commits: str) -> bool:
97104
ok = False
98105
continue
99106
prefix = subject.split(":")[0]
107+
if prefix.strip().upper() in BLACKLISTED_PREFIXES:
108+
print(f"{FAIL} Bad subsystem prefix '{prefix}': {line}")
109+
print(f" See: {DOCS_URL}")
110+
ok = False
100111
if not PREFIX_RE.match(prefix):
101112
print(f"{FAIL} Malformed subsystem prefix '{prefix}': {line}")
102113
print(" Prefix must contain only letters, digits, '.', '_', '/', '-', spaces, quotes.")

0 commit comments

Comments
 (0)