Commit 9e438eeb by Jamie Madill Committed by Commit Bot

Update presubmit checks.

- clarifies error for run_code_generation hashes. - makes missing format or bug tag an error. - check for spaces in bug tags. Bug: angleproject:3659 Change-Id: I069e60d8acdf070961bdf342acf976ddd1138b1b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1689019 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent c26b7914
...@@ -16,6 +16,23 @@ _IMPLEMENTATION_EXTENSIONS = r'\.(cc|cpp|cxx|mm)$' ...@@ -16,6 +16,23 @@ _IMPLEMENTATION_EXTENSIONS = r'\.(cc|cpp|cxx|mm)$'
_HEADER_EXTENSIONS = r'\.(h|hpp|hxx)$' _HEADER_EXTENSIONS = r'\.(h|hpp|hxx)$'
def _CheckChangeHasBugField(input_api, output_api):
"""Requires that the changelist have a Bug: field."""
bugs = input_api.change.BugsFromDescription()
if not bugs:
return [
output_api.PresubmitError(
'If this change has an associated bug, add Bug: angleproject:[bug number].')
]
elif not all([' ' not in bug for bug in bugs]):
return [
output_api.PresubmitError(
'Check bug tag formatting. Ensure there are no spaces after the colon.')
]
else:
return []
def _CheckCodeGeneration(input_api, output_api): def _CheckCodeGeneration(input_api, output_api):
class Msg(output_api.PresubmitError): class Msg(output_api.PresubmitError):
...@@ -24,10 +41,13 @@ def _CheckCodeGeneration(input_api, output_api): ...@@ -24,10 +41,13 @@ def _CheckCodeGeneration(input_api, output_api):
def __init__(self, message): def __init__(self, message):
super(output_api.PresubmitError, self).__init__( super(output_api.PresubmitError, self).__init__(
message, message,
long_text='Please ensure your ANGLE repositiory is synced to tip-of-tree\n' long_text='Please run scripts/run_code_generation.py to refresh generated hashes.\n'
'and you have an up-to-date checkout of all ANGLE dependencies.\n' '\n'
'If you are using ANGLE inside Chromium you may need to bootstrap ANGLE \n' 'If that fails, ensure your ANGLE repositiory is synced to tip-of-tree\n'
'and run gclient sync. See the DevSetup documentation for details.\n') 'and all ANGLE DEPS are fully up-to-date by running gclient sync.\n'
'\n'
'If you are building ANGLE inside Chromium you must bootstrap ANGLE\n'
'before gclient sync. See the DevSetup documentation for more details.\n')
code_gen_path = input_api.os_path.join(input_api.PresubmitLocalPath(), code_gen_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
'scripts/run_code_generation.py') 'scripts/run_code_generation.py')
...@@ -85,17 +105,21 @@ def _CheckNewHeaderWithoutGnChange(input_api, output_api): ...@@ -85,17 +105,21 @@ def _CheckNewHeaderWithoutGnChange(input_api, output_api):
def CheckChangeOnUpload(input_api, output_api): def CheckChangeOnUpload(input_api, output_api):
results = [] results = []
results.extend(_CheckCodeGeneration(input_api, output_api)) results.extend(_CheckCodeGeneration(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.CheckChangeHasDescription(input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeHasDescription(input_api, output_api))
results.extend(_CheckNewHeaderWithoutGnChange(input_api, output_api)) results.extend(_CheckNewHeaderWithoutGnChange(input_api, output_api))
results.extend(input_api.canned_checks.CheckPatchFormatted(input_api, output_api)) results.extend(
input_api.canned_checks.CheckPatchFormatted(
input_api, output_api, result_factory=output_api.PresubmitError))
return results return results
def CheckChangeOnCommit(input_api, output_api): def CheckChangeOnCommit(input_api, output_api):
results = [] results = []
results.extend(_CheckCodeGeneration(input_api, output_api)) results.extend(_CheckCodeGeneration(input_api, output_api))
results.extend(input_api.canned_checks.CheckPatchFormatted(input_api, output_api)) results.extend(
results.extend(input_api.canned_checks.CheckChangeHasBugField(input_api, output_api)) input_api.canned_checks.CheckPatchFormatted(
input_api, output_api, result_factory=output_api.PresubmitError))
results.extend(_CheckChangeHasBugField(input_api, output_api))
results.extend(input_api.canned_checks.CheckChangeHasDescription(input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeHasDescription(input_api, output_api))
return results return results
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