OLD | NEW |
1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 'You added one or more #includes that violate checkdeps rules.', | 439 'You added one or more #includes that violate checkdeps rules.', |
440 error_descriptions)) | 440 error_descriptions)) |
441 if warning_descriptions: | 441 if warning_descriptions: |
442 results.append(output_api.PresubmitPromptOrNotify( | 442 results.append(output_api.PresubmitPromptOrNotify( |
443 'You added one or more #includes of files that are temporarily\n' | 443 'You added one or more #includes of files that are temporarily\n' |
444 'allowed but being removed. Can you avoid introducing the\n' | 444 'allowed but being removed. Can you avoid introducing the\n' |
445 '#include? See relevant DEPS file(s) for details and contacts.', | 445 '#include? See relevant DEPS file(s) for details and contacts.', |
446 warning_descriptions)) | 446 warning_descriptions)) |
447 return results | 447 return results |
448 | 448 |
| 449 def _CheckChangeHasBugField(input_api, output_api): |
| 450 """Requires that the changelist have a BUG= field. |
| 451 |
| 452 This check is stricter than the one in depot_tools/presubmit_canned_checks.py |
| 453 since it fails the presubmit if the BUG= field is missing or doesn't contain |
| 454 a bug reference. |
| 455 """ |
| 456 if input_api.change.BUG: |
| 457 return [] |
| 458 else: |
| 459 return [output_api.PresubmitError( |
| 460 'The BUG=[bug number] field is mandatory. Please create a bug and ' |
| 461 'reference it using either of:\n' |
| 462 ' * https://bugs.webrtc.org - reference it using BUG=webrtc:XXXX\n' |
| 463 ' * https://crbug.com - reference it using BUG=chromium:XXXXXX')] |
449 | 464 |
450 def _CheckJSONParseErrors(input_api, output_api): | 465 def _CheckJSONParseErrors(input_api, output_api): |
451 """Check that JSON files do not contain syntax errors.""" | 466 """Check that JSON files do not contain syntax errors.""" |
452 | 467 |
453 def FilterFile(affected_file): | 468 def FilterFile(affected_file): |
454 return input_api.os_path.splitext(affected_file.LocalPath())[1] == '.json' | 469 return input_api.os_path.splitext(affected_file.LocalPath())[1] == '.json' |
455 | 470 |
456 def GetJSONParseError(input_api, filename): | 471 def GetJSONParseError(input_api, filename): |
457 try: | 472 try: |
458 contents = input_api.ReadFile(filename) | 473 contents = input_api.ReadFile(filename) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 602 |
588 def CheckChangeOnCommit(input_api, output_api): | 603 def CheckChangeOnCommit(input_api, output_api): |
589 results = [] | 604 results = [] |
590 results.extend(_CommonChecks(input_api, output_api)) | 605 results.extend(_CommonChecks(input_api, output_api)) |
591 results.extend(_VerifyNativeApiHeadersListIsValid(input_api, output_api)) | 606 results.extend(_VerifyNativeApiHeadersListIsValid(input_api, output_api)) |
592 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) | 607 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
593 results.extend(input_api.canned_checks.CheckChangeWasUploaded( | 608 results.extend(input_api.canned_checks.CheckChangeWasUploaded( |
594 input_api, output_api)) | 609 input_api, output_api)) |
595 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 610 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
596 input_api, output_api)) | 611 input_api, output_api)) |
597 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 612 results.extend(_CheckChangeHasBugField(input_api, output_api)) |
598 input_api, output_api)) | |
599 results.extend(input_api.canned_checks.CheckChangeHasTestField( | 613 results.extend(input_api.canned_checks.CheckChangeHasTestField( |
600 input_api, output_api)) | 614 input_api, output_api)) |
601 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 615 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
602 input_api, output_api, | 616 input_api, output_api, |
603 json_url='http://webrtc-status.appspot.com/current?format=json')) | 617 json_url='http://webrtc-status.appspot.com/current?format=json')) |
604 return results | 618 return results |
605 | 619 |
606 | 620 |
607 # pylint: disable=W0613 | 621 # pylint: disable=W0613 |
608 def GetPreferredTryMasters(project, change): | 622 def GetPreferredTryMasters(project, change): |
(...skipping 11 matching lines...) Expand all Loading... |
620 for builder in masters[master]: | 634 for builder in masters[master]: |
621 if 'presubmit' in builder: | 635 if 'presubmit' in builder: |
622 # Do not trigger presubmit builders, since they're likely to fail | 636 # Do not trigger presubmit builders, since they're likely to fail |
623 # (e.g. OWNERS checks before finished code review), and we're running | 637 # (e.g. OWNERS checks before finished code review), and we're running |
624 # local presubmit anyway. | 638 # local presubmit anyway. |
625 pass | 639 pass |
626 else: | 640 else: |
627 try_config[master][builder] = ['defaulttests'] | 641 try_config[master][builder] = ['defaulttests'] |
628 | 642 |
629 return try_config | 643 return try_config |
OLD | NEW |