Commit d9978e94 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[test] Enforce correct BUG numbers in commit messages

NOTRY=true

Change-Id: Idfcc2481ae65f8098ecc94c20f992f3f3b874b8c
Reviewed-on: https://chromium-review.googlesource.com/454716Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43790}
parent 32db0de4
......@@ -250,6 +250,7 @@ def _CheckMissingFiles(input_api, output_api):
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
results.extend(_CheckCommitMessageBugEntry(input_api, output_api))
results.extend(input_api.canned_checks.CheckOwners(
input_api, output_api, source_file_filter=None))
results.extend(input_api.canned_checks.CheckPatchFormatted(
......@@ -276,6 +277,25 @@ def _SkipTreeCheck(input_api, output_api):
return input_api.environ.get('PRESUBMIT_TREE_CHECK') == 'skip'
def _CheckCommitMessageBugEntry(input_api, output_api):
"""Check that bug entries are well-formed in commit message."""
results = []
for bug in (input_api.change.BUG or '').split(','):
bug = bug.strip()
if 'none'.startswith(bug.lower()):
continue
if ':' not in bug:
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))
except ValueError:
results.append('Bogus BUG entry: %s' % bug)
return [output_api.PresubmitError(r) for r in results]
def CheckChangeOnUpload(input_api, output_api):
results = []
results.extend(_CommonChecks(input_api, output_api))
......
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