Chromium Code Reviews| 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 |
| 11 import os | 11 import os |
| 12 import re | 12 import re |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 | 15 |
| 16 _EXCLUDED_PATHS = () | |
| 17 | |
| 18 | |
| 19 def _CheckForNonBlinkVariantMojomIncludes(input_api, output_api): | 16 def _CheckForNonBlinkVariantMojomIncludes(input_api, output_api): |
| 20 pattern = input_api.re.compile(r'#include\s+.+\.mojom(.*)\.h[>"]') | 17 pattern = input_api.re.compile(r'#include\s+.+\.mojom(.*)\.h[>"]') |
| 21 errors = [] | 18 errors = [] |
| 22 for f in input_api.AffectedFiles(): | 19 for f in input_api.AffectedFiles(): |
| 23 for line_num, line in f.ChangedContents(): | 20 for line_num, line in f.ChangedContents(): |
| 24 m = pattern.match(line) | 21 m = pattern.match(line) |
| 25 if m and m.group(1) != '-blink': | 22 if m and m.group(1) != '-blink': |
| 26 errors.append(' %s:%d %s' % ( | 23 errors.append(' %s:%d %s' % ( |
| 27 f.LocalPath(), line_num, line)) | 24 f.LocalPath(), line_num, line)) |
| 28 | 25 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 | 77 |
| 81 if log_buffer.getvalue(): | 78 if log_buffer.getvalue(): |
| 82 errors.append(output_api.PresubmitError( | 79 errors.append(output_api.PresubmitError( |
| 83 'Cannot parse WATCHLISTS file, please resolve.', | 80 'Cannot parse WATCHLISTS file, please resolve.', |
| 84 log_buffer.getvalue().splitlines())) | 81 log_buffer.getvalue().splitlines())) |
| 85 return errors | 82 return errors |
| 86 | 83 |
| 87 | 84 |
| 88 def _CommonChecks(input_api, output_api): | 85 def _CommonChecks(input_api, output_api): |
| 89 """Checks common to both upload and commit.""" | 86 """Checks common to both upload and commit.""" |
| 90 # We should figure out what license checks we actually want to use. | |
| 91 license_header = r'.*' | |
| 92 | |
| 93 results = [] | 87 results = [] |
| 94 results.extend(input_api.canned_checks.PanProjectChecks( | |
| 95 input_api, output_api, excluded_paths=_EXCLUDED_PATHS, | |
| 96 maxlen=800, license_header=license_header)) | |
|
dcheng
2016/09/27 19:08:47
Won't this complain if someone modifies a file tha
Nico
2016/09/27 19:10:55
I was wondering that. But I think we currently run
Dirk Pranke
2016/09/27 21:27:25
In the top-level //PRESUBMIT.py, we exclude //thir
| |
| 97 results.extend(_CheckForNonBlinkVariantMojomIncludes(input_api, output_api)) | 88 results.extend(_CheckForNonBlinkVariantMojomIncludes(input_api, output_api)) |
| 98 results.extend(_CheckForVersionControlConflicts(input_api, output_api)) | 89 results.extend(_CheckForVersionControlConflicts(input_api, output_api)) |
| 99 results.extend(_CheckPatchFiles(input_api, output_api)) | 90 results.extend(_CheckPatchFiles(input_api, output_api)) |
| 100 results.extend(_CheckTestExpectations(input_api, output_api)) | 91 results.extend(_CheckTestExpectations(input_api, output_api)) |
| 101 results.extend(_CheckChromiumPlatformMacros(input_api, output_api)) | 92 results.extend(_CheckChromiumPlatformMacros(input_api, output_api)) |
| 102 results.extend(_CheckWatchlist(input_api, output_api)) | 93 results.extend(_CheckWatchlist(input_api, output_api)) |
| 103 results.extend(_CheckFilePermissions(input_api, output_api)) | 94 results.extend(_CheckFilePermissions(input_api, output_api)) |
| 104 return results | 95 return results |
| 105 | 96 |
| 106 | 97 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 371 new_description = description | 362 new_description = description |
| 372 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) | 363 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) |
| 373 results.append(output_api.PresubmitNotifyResult( | 364 results.append(output_api.PresubmitNotifyResult( |
| 374 'Automatically added slimming-paint-v2 tests to run on CQ due to ' | 365 'Automatically added slimming-paint-v2 tests to run on CQ due to ' |
| 375 'changes in paint or compositing directories.')) | 366 'changes in paint or compositing directories.')) |
| 376 | 367 |
| 377 if new_description != description: | 368 if new_description != description: |
| 378 rietveld_obj.update_description(issue, new_description) | 369 rietveld_obj.update_description(issue, new_description) |
| 379 | 370 |
| 380 return results | 371 return results |
| OLD | NEW |