diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index a14c9202b..0ef5bb987 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -50,7 +50,13 @@ OFF_UNLESS_MANUALLY_ENABLED_LINT_FILTERS = [ def CheckChangeHasBugField(input_api, output_api): """Requires that the changelist have a Bug: field.""" - if input_api.change.BugsFromDescription(): + bugs = input_api.change.BugsFromDescription() + if bugs: + if any(b.startswith('b/') for b in bugs): + return [ + output_api.PresubmitNotifyResult( + 'Buganizer bugs should be prefixed with b:, not b/.') + ] return [] else: return [output_api.PresubmitNotifyResult( diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 402f1c295..e5a0d0660 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -1993,9 +1993,13 @@ class CannedChecksUnittest(PresubmitTestsBase): def testCannedCheckChangeHasBugField(self): self.DescriptionTest(presubmit_canned_checks.CheckChangeHasBugField, - 'Foo\nBUG=1234', 'Foo\n', - presubmit.OutputApi.PresubmitNotifyResult, - False) + 'Foo\nBUG=b:1234', 'Foo\n', + presubmit.OutputApi.PresubmitNotifyResult, False) + + def testCannedCheckChangeHasBugFieldWithBuganizerSlash(self): + self.DescriptionTest(presubmit_canned_checks.CheckChangeHasBugField, + 'Foo\nBUG=b:1234', 'Foo\nBUG=b/1234', + presubmit.OutputApi.PresubmitNotifyResult, False) def testCannedCheckChangeHasNoUnwantedTags(self): self.DescriptionTest(presubmit_canned_checks.CheckChangeHasNoUnwantedTags,