XZise has uploaded a new change for review.
https://gerrit.wikimedia.org/r/247048
Change subject: [FEAT] Verify phabricator bug ids
......................................................................
[FEAT] Verify phabricator bug ids
This requires that the bug ids are always phabricator ids (meaning that they
use the format `T\d+`). This is applied to all `Bug:` lines and similar
sounding prefixes.
It also does asserts if the commit message header does not start with a bug id.
Change-Id: Ib94bf559e8f7b14e93622e96a8af8149f50a08d3
---
M tests/test_commit-message-validator/check_message_errors.out
M tools/commit-message-validator.py
2 files changed, 13 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/integration/jenkins
refs/changes/48/247048/1
diff --git a/tests/test_commit-message-validator/check_message_errors.out
b/tests/test_commit-message-validator/check_message_errors.out
index 43d414d..a54cc06 100644
--- a/tests/test_commit-message-validator/check_message_errors.out
+++ b/tests/test_commit-message-validator/check_message_errors.out
@@ -3,11 +3,15 @@
Line 3: Line should be <=100 characters
Line 4: Use 'Bug: ' not 'Fixes:'
Line 4: Expected one space after 'Bug:'
+Line 4: The bug ID is not a phabricator task: foo
Line 5: Use 'Bug: ' not 'Closes:'
Line 5: Expected one space after 'Bug:'
+Line 5: The bug ID is not a phabricator task: bar
Line 6: Use 'Bug: ' not 'Task:'
Line 7: Expected 'Bug:' not 'BUG:'
Line 7: Expected one space after 'Bug:'
+Line 7: The bug ID must be a phabricator task: 13
+Line 8: The bug ID is not a phabricator task: T11 T12
Line 8: Expected blank line before Bug:
Line 9: Unexpected blank line after Bug:
Line 12: Unexpected blank line after Bug:
diff --git a/tools/commit-message-validator.py
b/tools/commit-message-validator.py
index c0f4ba9..790e9d6 100755
--- a/tools/commit-message-validator.py
+++ b/tools/commit-message-validator.py
@@ -31,6 +31,9 @@
if lineno == 0:
if len(line) > 80:
yield "First line should be <=80 characters"
+ m = re.match(r'^T?\d+', line)
+ if m:
+ yield "Do not define bug in the header"
# Second line blank
elif lineno == 1:
@@ -56,6 +59,12 @@
if m.group(2) != ' ':
yield "Expected one space after 'Bug:'"
+ bug_id = m.group(3).strip()
+ if bug_id.isdigit():
+ yield "The bug ID must be a phabricator task: {0}".format(bug_id)
+ elif not bug_id.startswith('T') or not bug_id[1:].isdigit():
+ yield "The bug ID is not a phabricator task: {0}".format(bug_id)
+
def check_message(lines):
"""Check a commit message to see if it has errors.
--
To view, visit https://gerrit.wikimedia.org/r/247048
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib94bf559e8f7b14e93622e96a8af8149f50a08d3
Gerrit-PatchSet: 1
Gerrit-Project: integration/jenkins
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits