Show error on Fixes: and suggest Fixed:

The Bug: syntax is well known as a way of tagging bugs in a commit
message, at least partially because when it is missing there is a
presubmit warning suggesting that it be used.

The Fixed: syntax is less well known because there is no such reminder.
And, if somebody types "Fixes: " instead of "Fixed: " there is no error.
Therefore it is not surprising that "Fixes: " was used seven times in
the last 10,000 commits. See crrev.com/c/4416218 for one example.

This change adds both a reminder that Fixed: exists as well as an error
if Fixes: is used.

Fixed: 1434702
Change-Id: Id940d0af5cfea206ee923fbb779bf686b34c5f33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4436316
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
changes/16/4436316/5
Bruce Dawson 2 years ago committed by LUCI CQ
parent 183769121f
commit 407e5e7b66

@ -71,16 +71,24 @@ _CORP_LINK_KEYWORD = '.corp.google'
def CheckChangeHasBugField(input_api, output_api):
"""Requires that the changelist have a Bug: field."""
bugs = input_api.change.BugsFromDescription()
results = []
if bugs:
if any(b.startswith('b/') for b in bugs):
return [
results.append(
output_api.PresubmitNotifyResult(
'Buganizer bugs should be prefixed with b:, not b/.')
]
return []
'Buganizer bugs should be prefixed with b:, not b/.'))
else:
results.append(
output_api.PresubmitNotifyResult(
'If this change has an associated bug, add Bug: [bug number] or '
'Fixed: [bug number].'))
if 'Fixes' in input_api.change.GitFootersFromDescription():
results.append(
output_api.PresubmitError(
'Fixes: is the wrong footer tag, use Fixed: instead.'))
return results
return [output_api.PresubmitNotifyResult(
'If this change has an associated bug, add Bug: [bug number].')]
def CheckChangeHasNoUnwantedTags(input_api, output_api):
UNWANTED_TAGS = {

Loading…
Cancel
Save