Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: PRESUBMIT.py

Issue 2322843003: PRESUBMIT: Make BUG= field mandatory. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 04de7c8def9392b87b16347e19f00ca00a85aeb1..99131c45da65264824c5ddbb2d372079b27b59c7 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -446,6 +446,21 @@ def _CheckUnwantedDependencies(input_api, output_api):
warning_descriptions))
return results
+def _CheckChangeHasBugField(input_api, output_api):
+ """Requires that the changelist have a BUG= field.
+
+ This check is stricter than the one in depot_tools/presubmit_canned_checks.py
+ since it fails the presubmit if the BUG= field is missing or doesn't contain
+ a bug reference.
+ """
+ if input_api.change.BUG:
+ return []
+ else:
+ return [output_api.PresubmitError(
+ 'The BUG=[bug number] field is mandatory. Please create a bug and '
+ 'reference it using either of:\n'
+ ' * https://bugs.webrtc.org - reference it using BUG=webrtc:XXXX\n'
+ ' * https://crbug.com - reference it using BUG=chromium:XXXXXX')]
def _CheckJSONParseErrors(input_api, output_api):
"""Check that JSON files do not contain syntax errors."""
@@ -594,8 +609,7 @@ def CheckChangeOnCommit(input_api, output_api):
input_api, output_api))
results.extend(input_api.canned_checks.CheckChangeHasDescription(
input_api, output_api))
- results.extend(input_api.canned_checks.CheckChangeHasBugField(
- input_api, output_api))
+ results.extend(_CheckChangeHasBugField(input_api, output_api))
results.extend(input_api.canned_checks.CheckChangeHasTestField(
input_api, output_api))
results.extend(input_api.canned_checks.CheckTreeIsOpen(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698