Commit 38c5e82f authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[test] Enforce tracker prefix for all BUG entries

This enforces the prefix for v8 and chromium, as otherwise the links don't work in code review. Also prevents using html links to not confuse bugdroid.

NOTRY=true

Change-Id: Iaf3b97c9a7d7a87c27736d4b1f8c286daaffd452
Reviewed-on: https://chromium-review.googlesource.com/454796
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43792}
parent 0332bebd
......@@ -31,6 +31,7 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into gcl.
"""
import re
import sys
......@@ -279,6 +280,9 @@ def _SkipTreeCheck(input_api, output_api):
def _CheckCommitMessageBugEntry(input_api, output_api):
"""Check that bug entries are well-formed in commit message."""
bogus_bug_msg = (
'Bogus BUG entry: %s. Please specify the issue tracker prefix and the '
'issue number, separated by a colon, e.g. v8:123 or chromium:12345.')
results = []
for bug in (input_api.change.BUG or '').split(','):
bug = bug.strip()
......@@ -288,11 +292,15 @@ def _CheckCommitMessageBugEntry(input_api, output_api):
try:
if int(bug) > 100000:
# Rough indicator for current chromium bugs.
results.append(
'BUG=%s is probably not from V8 tracker. '
'Please add correct prefix, e.g. "chromium:%s"' % (bug, bug))
prefix_guess = 'chromium'
else:
prefix_guess = 'v8'
results.append('BUG entry requires issue tracker prefix, e.g. %s:%s' %
(prefix_guess, bug))
except ValueError:
results.append('Bogus BUG entry: %s' % bug)
results.append(bogus_bug_msg % bug)
elif not re.match(r'\w+:\d+', bug):
results.append(bogus_bug_msg % bug)
return [output_api.PresubmitError(r) for r in results]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment