OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
6 | 6 |
7 | 7 |
8 ### Description checks | 8 ### Description checks |
9 | 9 |
10 def CheckChangeHasTestField(input_api, output_api): | 10 def CheckChangeHasTestField(input_api, output_api): |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 'Build(s) pending. It is suggested to wait that no more than %d ' | 624 'Build(s) pending. It is suggested to wait that no more than %d ' |
625 'builds are pending.' % max_pendings, | 625 'builds are pending.' % max_pendings, |
626 long_text='\n'.join(out))] | 626 long_text='\n'.join(out))] |
627 return [] | 627 return [] |
628 | 628 |
629 | 629 |
630 def CheckOwners(input_api, output_api, source_file_filter=None): | 630 def CheckOwners(input_api, output_api, source_file_filter=None): |
631 if not input_api.is_committing: | 631 if not input_api.is_committing: |
632 return [] | 632 return [] |
633 if input_api.tbr: | 633 if input_api.tbr: |
634 return [output_api.PresubmitNotifyResult('--tbr was specified, ' | 634 return [output_api.PresubmitNotifyResult( |
635 'skipping OWNERS check')] | 635 '--tbr was specified, skipping OWNERS check')] |
636 if not input_api.change.issue: | 636 if not input_api.change.issue: |
637 return [output_api.PresubmitError('Change not uploaded for review')] | 637 return [output_api.PresubmitError( |
| 638 "OWNERS check failed: this change has no Rietveld issue number, so " |
| 639 "we can't check it for approvals.")] |
638 | 640 |
639 affected_files = set([f.LocalPath() for f in | 641 affected_files = set([f.LocalPath() for f in |
640 input_api.change.AffectedFiles(source_file_filter)]) | 642 input_api.change.AffectedFiles(source_file_filter)]) |
641 | 643 |
642 owners_db = input_api.owners_db | 644 owners_db = input_api.owners_db |
643 owner_email, approvers = _RietveldOwnerAndApprovers(input_api, | 645 owner_email, approvers = _RietveldOwnerAndApprovers(input_api, |
644 owners_db.email_regexp) | 646 owners_db.email_regexp) |
645 approvers_plus_owner = approvers.union(set([owner_email])) | 647 approvers_plus_owner = approvers.union(set([owner_email])) |
646 | 648 |
647 missing_files = owners_db.files_not_covered_by(affected_files, | 649 missing_files = owners_db.files_not_covered_by(affected_files, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 input_api, output_api, source_file_filter=text_files)) | 828 input_api, output_api, source_file_filter=text_files)) |
827 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 829 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
828 input_api, output_api)) | 830 input_api, output_api)) |
829 results.extend(input_api.canned_checks.CheckLicense( | 831 results.extend(input_api.canned_checks.CheckLicense( |
830 input_api, output_api, license_header, source_file_filter=sources)) | 832 input_api, output_api, license_header, source_file_filter=sources)) |
831 results.extend(_CheckConstNSObject( | 833 results.extend(_CheckConstNSObject( |
832 input_api, output_api, source_file_filter=sources)) | 834 input_api, output_api, source_file_filter=sources)) |
833 results.extend(_CheckSingletonInHeaders( | 835 results.extend(_CheckSingletonInHeaders( |
834 input_api, output_api, source_file_filter=sources)) | 836 input_api, output_api, source_file_filter=sources)) |
835 return results | 837 return results |
OLD | NEW |