Commit b295105c authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Make presubmit bark at FIXED= in CL description

"Fixed:" is equivalent and the preferred syntax.

Also sets up a more generic mechanism for "unwanted tags",
which BUG= and TBR= may eventually be when we're ready to
move over to git-footers more fully.

Bug: monorail:4470
Change-Id: I2e999d364292447124870b8d3539fde1ac1eb4ec
Recipe-Nontrivial-Roll: chromiumos
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1836607
Auto-Submit: Dan Beam <dbeam@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
parent 6295404c
......@@ -49,6 +49,22 @@ def CheckChangeHasBugField(input_api, output_api):
return [output_api.PresubmitNotifyResult(
'If this change has an associated bug, add Bug: [bug number].')]
def CheckChangeHasNoUnwantedTags(input_api, output_api):
UNWANTED_TAGS = {
'FIXED': {
'why': 'is not supported',
'instead': 'Use "Fixed:" instead.'
},
# TODO: BUG, ISSUE
}
errors = []
for tag, desc in UNWANTED_TAGS.items():
if tag in input_api.change.tags:
subs = tag, desc['why'], desc.get('instead', '')
errors.append(('%s= %s. %s' % subs).rstrip())
return [output_api.PresubmitError('\n'.join(errors))] if errors else []
def CheckDoNotSubmitInDescription(input_api, output_api):
"""Checks that the user didn't add 'DO NOT ''SUBMIT' to the CL description.
......
......@@ -1582,6 +1582,11 @@ class CannedChecksUnittest(PresubmitTestsBase):
presubmit.OutputApi.PresubmitNotifyResult,
False)
def testCannedCheckChangeHasNoUnwantedTags(self):
self.DescriptionTest(presubmit_canned_checks.CheckChangeHasNoUnwantedTags,
'Foo\n', 'Foo\nFIXED=1234',
presubmit.OutputApi.PresubmitError, False)
def testCheckChangeHasDescription(self):
self.DescriptionTest(presubmit_canned_checks.CheckChangeHasDescription,
'Bleh', '',
......
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