[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: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#43792}
This commit is contained in:
parent
0332bebde9
commit
38c5e82f11
16
PRESUBMIT.py
16
PRESUBMIT.py
@ -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]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user