| OLD | NEW |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2014 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 infra. | 5 """Top-level presubmit script for infra. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
| 8 details on the presubmit API built into gcl. | 8 details on the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 'infra/services/lkgr_finder', | 25 'infra/services/lkgr_finder', |
| 26 'infra/services/gnumbd', | 26 'infra/services/gnumbd', |
| 27 | 27 |
| 28 # Don't bother pylinting (these could also move to .gitignore): | 28 # Don't bother pylinting (these could also move to .gitignore): |
| 29 '.*/__pycache__', | 29 '.*/__pycache__', |
| 30 '\.git', | 30 '\.git', |
| 31 '\.wheelcache', | 31 '\.wheelcache', |
| 32 'bootstrap/virtualenv', | 32 'bootstrap/virtualenv', |
| 33 ] | 33 ] |
| 34 | 34 |
| 35 # List of third_party direcories. |
| 36 THIRD_PARTY_DIRS = [ |
| 37 'appengine/third_party', |
| 38 # Remove this when virtualenv is unvendored. |
| 39 'bootstrap/virtualenv', |
| 40 ] |
| 41 |
| 35 # List of directories to jshint. | 42 # List of directories to jshint. |
| 36 JSHINT_PROJECTS = [ | 43 JSHINT_PROJECTS = [ |
| 37 'appengine/chromium_cq_status', | 44 'appengine/chromium_cq_status', |
| 38 'appengine/chromium_status', | 45 'appengine/chromium_status', |
| 39 'appengine/milo', | 46 'appengine/milo', |
| 40 'appengine/chrome_infra_console_loadtest', | 47 'appengine/chrome_infra_console_loadtest', |
| 41 'appengine/chrome_infra_packages', | 48 'appengine/chrome_infra_packages', |
| 42 ] | 49 ] |
| 43 # List of blacklisted directories that we don't want to jshint. | 50 # List of blacklisted directories that we don't want to jshint. |
| 44 JSHINT_PROJECTS_BLACKLIST = [ | 51 JSHINT_PROJECTS_BLACKLIST = THIRD_PARTY_DIRS |
| 45 'appengine/third_party', | |
| 46 ] | |
| 47 | 52 |
| 48 # Files that must not be modified (regex) | 53 # Files that must not be modified (regex) |
| 49 # Paths tested are relative to the directory containing this file. | 54 # Paths tested are relative to the directory containing this file. |
| 50 # Ex: infra/libs/logs.py | 55 # Ex: infra/libs/logs.py |
| 51 NOFORK_PATHS = [] | 56 NOFORK_PATHS = [] |
| 52 | 57 |
| 53 | 58 |
| 54 # Forked from depot_tools/presubmit_canned_checks._FetchAllFiles | 59 # Forked from depot_tools/presubmit_canned_checks._FetchAllFiles |
| 55 def FetchAllFiles(input_api, white_list, black_list): | 60 def FetchAllFiles(input_api, white_list, black_list): |
| 56 import datetime | 61 import datetime |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 cmd = [input_api.python_executable, node_jshint_path, js_file] | 338 cmd = [input_api.python_executable, node_jshint_path, js_file] |
| 334 tests.append(input_api.Command( | 339 tests.append(input_api.Command( |
| 335 name='Jshint %s' % js_file, | 340 name='Jshint %s' % js_file, |
| 336 cmd=cmd, | 341 cmd=cmd, |
| 337 kwargs={}, | 342 kwargs={}, |
| 338 message=output_api.PresubmitError)) | 343 message=output_api.PresubmitError)) |
| 339 return tests | 344 return tests |
| 340 | 345 |
| 341 | 346 |
| 342 def CommonChecks(input_api, output_api): # pragma: no cover | 347 def CommonChecks(input_api, output_api): # pragma: no cover |
| 348 third_party_filter = lambda path: input_api.FilterSourceFile( |
| 349 path, black_list=THIRD_PARTY_DIRS) |
| 343 output = input_api.RunTests(PylintChecks(input_api, output_api)) | 350 output = input_api.RunTests(PylintChecks(input_api, output_api)) |
| 344 output.extend(input_api.RunTests(JshintChecks(input_api, output_api))) | 351 output.extend(input_api.RunTests(JshintChecks(input_api, output_api))) |
| 345 output.extend(BrokenLinksChecks(input_api, output_api)) | 352 output.extend(BrokenLinksChecks(input_api, output_api)) |
| 346 output.extend( | 353 output.extend( input_api.canned_checks.CheckGenderNeutral( |
| 347 input_api.canned_checks.CheckGenderNeutral(input_api, output_api)) | 354 input_api, output_api, source_file_filter=third_party_filter)) |
| 348 return output | 355 return output |
| 349 | 356 |
| 350 | 357 |
| 351 def CheckChangeOnUpload(input_api, output_api): # pragma: no cover | 358 def CheckChangeOnUpload(input_api, output_api): # pragma: no cover |
| 352 output = CommonChecks(input_api, output_api) | 359 output = CommonChecks(input_api, output_api) |
| 353 output.extend(NoForkCheck(input_api, output_api)) | 360 output.extend(NoForkCheck(input_api, output_api)) |
| 354 output.extend(EmptiedFilesCheck(input_api, output_api)) | 361 output.extend(EmptiedFilesCheck(input_api, output_api)) |
| 355 output.extend(GoGoopRollCheck(input_api, output_api)) | 362 output.extend(GoGoopRollCheck(input_api, output_api)) |
| 356 return output | 363 return output |
| 357 | 364 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 382 try_config = {} | 389 try_config = {} |
| 383 for master in masters: | 390 for master in masters: |
| 384 try_config.setdefault(master, {}) | 391 try_config.setdefault(master, {}) |
| 385 for builder in masters[master]: | 392 for builder in masters[master]: |
| 386 # Do not trigger presubmit builders, since they're likely to fail | 393 # Do not trigger presubmit builders, since they're likely to fail |
| 387 # (e.g. OWNERS checks before finished code review), and we're | 394 # (e.g. OWNERS checks before finished code review), and we're |
| 388 # running local presubmit anyway. | 395 # running local presubmit anyway. |
| 389 if 'presubmit' not in builder.lower(): | 396 if 'presubmit' not in builder.lower(): |
| 390 try_config[master][builder] = ['defaulttests'] | 397 try_config[master][builder] = ['defaulttests'] |
| 391 return try_config | 398 return try_config |
| OLD | NEW |