| OLD | NEW | 
|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be | 
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. | 
| 4 | 4 | 
| 5 """Top-level presubmit script for Blink. | 5 """Top-level presubmit script for Blink. | 
| 6 | 6 | 
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 
| 8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. | 
| 9 """ | 9 """ | 
| 10 | 10 | 
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 226             "Source", "devtools", "scripts", "compile_frontend.py") | 226             "Source", "devtools", "scripts", "compile_frontend.py") | 
| 227         out, _ = input_api.subprocess.Popen( | 227         out, _ = input_api.subprocess.Popen( | 
| 228             [input_api.python_executable, lint_path], | 228             [input_api.python_executable, lint_path], | 
| 229             stdout=input_api.subprocess.PIPE, | 229             stdout=input_api.subprocess.PIPE, | 
| 230             stderr=input_api.subprocess.STDOUT).communicate() | 230             stderr=input_api.subprocess.STDOUT).communicate() | 
| 231         if "WARNING" in out or "ERROR" in out: | 231         if "WARNING" in out or "ERROR" in out: | 
| 232             return [output_api.PresubmitError(out)] | 232             return [output_api.PresubmitError(out)] | 
| 233     return [] | 233     return [] | 
| 234 | 234 | 
| 235 | 235 | 
|  | 236 def _CheckForPrintfDebugging(input_api, output_api): | 
|  | 237     """Generally speaking, we'd prefer not to land patches that printf | 
|  | 238     debug output.""" | 
|  | 239     os_macro_re = input_api.re.compile(r'^\s*printf\(') | 
|  | 240     errors = input_api.canned_checks._FindNewViolationsOfRule( | 
|  | 241         lambda _, x: not os_macro_re.search(x), | 
|  | 242         input_api, None) | 
|  | 243     errors = ['  * %s' % violation for violation in errors] | 
|  | 244     if errors: | 
|  | 245         return [output_api.PresubmitPromptOrNotify( | 
|  | 246                     'printf debugging is best debugging! That said, it might ' | 
|  | 247                     'be a good idea to drop the following occurances from ' | 
|  | 248                     'your patch before uploading:\n%s' % '\n'.join(errors))] | 
|  | 249     return [] | 
|  | 250 | 
|  | 251 | 
| 236 def CheckChangeOnUpload(input_api, output_api): | 252 def CheckChangeOnUpload(input_api, output_api): | 
| 237     results = [] | 253     results = [] | 
| 238     results.extend(_CommonChecks(input_api, output_api)) | 254     results.extend(_CommonChecks(input_api, output_api)) | 
| 239     results.extend(_CheckStyle(input_api, output_api)) | 255     results.extend(_CheckStyle(input_api, output_api)) | 
|  | 256     results.extend(_CheckForPrintfDebugging(input_api, output_api)) | 
| 240     results.extend(_CompileDevtoolsFrontend(input_api, output_api)) | 257     results.extend(_CompileDevtoolsFrontend(input_api, output_api)) | 
| 241     return results | 258     return results | 
| 242 | 259 | 
| 243 | 260 | 
| 244 def CheckChangeOnCommit(input_api, output_api): | 261 def CheckChangeOnCommit(input_api, output_api): | 
| 245     results = [] | 262     results = [] | 
| 246     results.extend(_CommonChecks(input_api, output_api)) | 263     results.extend(_CommonChecks(input_api, output_api)) | 
| 247     results.extend(input_api.canned_checks.CheckTreeIsOpen( | 264     results.extend(input_api.canned_checks.CheckTreeIsOpen( | 
| 248         input_api, output_api, | 265         input_api, output_api, | 
| 249         json_url='http://blink-status.appspot.com/current?format=json')) | 266         json_url='http://blink-status.appspot.com/current?format=json')) | 
| 250     results.extend(input_api.canned_checks.CheckChangeHasDescription( | 267     results.extend(input_api.canned_checks.CheckChangeHasDescription( | 
| 251         input_api, output_api)) | 268         input_api, output_api)) | 
| 252     results.extend(_CheckSubversionConfig(input_api, output_api)) | 269     results.extend(_CheckSubversionConfig(input_api, output_api)) | 
| 253     return results | 270     return results | 
| 254 | 271 | 
| 255 def GetPreferredTrySlaves(project, change): | 272 def GetPreferredTrySlaves(project, change): | 
| 256     return ['linux_blink_rel', 'mac_blink_rel', 'win_blink_rel'] | 273     return ['linux_blink_rel', 'mac_blink_rel', 'win_blink_rel'] | 
| OLD | NEW | 
|---|