OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import os as _os | 7 import os as _os |
8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) | 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) |
9 | 9 |
10 | 10 |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 owner_email, reviewers = _RietveldOwnerAndReviewers( | 790 owner_email, reviewers = _RietveldOwnerAndReviewers( |
791 input_api, | 791 input_api, |
792 owners_db.email_regexp, | 792 owners_db.email_regexp, |
793 approval_needed=input_api.is_committing) | 793 approval_needed=input_api.is_committing) |
794 | 794 |
795 if owner_email: | 795 if owner_email: |
796 message = '' | 796 message = '' |
797 reviewers_plus_owner = reviewers.union(set([owner_email])) | 797 reviewers_plus_owner = reviewers.union(set([owner_email])) |
798 else: | 798 else: |
799 message = ('\nUntil the issue is uploaded, this list will include ' | 799 message = ('\nUntil the issue is uploaded, this list will include ' |
800 'directories for which you \nare an OWNER.') | 800 'files for which you are an OWNER.') |
801 owner_email = '' | 801 owner_email = '' |
802 reviewers_plus_owner = set() | 802 reviewers_plus_owner = set() |
803 | 803 |
804 missing_directories = owners_db.directories_not_covered_by(affected_files, | 804 missing_files = owners_db.files_not_covered_by(affected_files, |
805 reviewers_plus_owner) | 805 reviewers_plus_owner) |
806 if missing_directories: | 806 if missing_files: |
807 output_list = [ | 807 output_list = [ |
808 output('Missing %s for files in these directories:\n %s%s' % | 808 output('Missing %s for these files:\n %s%s' % |
809 (needed, '\n '.join(missing_directories), message))] | 809 (needed, '\n '.join(missing_files), message))] |
810 if not input_api.is_committing: | 810 if not input_api.is_committing: |
811 suggested_owners = owners_db.reviewers_for(affected_files) | 811 suggested_owners = owners_db.reviewers_for(affected_files) |
812 output_list.append(output('Suggested OWNERS:\n %s' % | 812 output_list.append(output('Suggested OWNERS:\n %s' % |
813 ('\n '.join(suggested_owners)))) | 813 ('\n '.join(suggested_owners)))) |
814 return output_list | 814 return output_list |
815 | 815 |
816 if input_api.is_committing and not reviewers: | 816 if input_api.is_committing and not reviewers: |
817 return [output('Missing LGTM from someone other than %s' % owner_email)] | 817 return [output('Missing LGTM from someone other than %s' % owner_email)] |
818 return [] | 818 return [] |
819 | 819 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 snapshot("checking description") | 1008 snapshot("checking description") |
1009 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1009 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
1010 input_api, output_api)) | 1010 input_api, output_api)) |
1011 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( | 1011 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( |
1012 input_api, output_api)) | 1012 input_api, output_api)) |
1013 snapshot("checking do not submit in files") | 1013 snapshot("checking do not submit in files") |
1014 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( | 1014 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( |
1015 input_api, output_api)) | 1015 input_api, output_api)) |
1016 snapshot("done") | 1016 snapshot("done") |
1017 return results | 1017 return results |
OLD | NEW |