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 import time | |
8 | |
9 | 7 |
10 ### Description checks | 8 ### Description checks |
11 | 9 |
12 def CheckChangeHasTestField(input_api, output_api): | 10 def CheckChangeHasTestField(input_api, output_api): |
13 """Requires that the changelist have a TEST= field.""" | 11 """Requires that the changelist have a TEST= field.""" |
14 if input_api.change.TEST: | 12 if input_api.change.TEST: |
15 return [] | 13 return [] |
16 else: | 14 else: |
17 return [output_api.PresubmitNotifyResult( | 15 return [output_api.PresubmitNotifyResult( |
18 'If this change requires manual test instructions to QA team, add ' | 16 'If this change requires manual test instructions to QA team, add ' |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 r'.*\.json', | 752 r'.*\.json', |
755 ) | 753 ) |
756 project_name = project_name or 'Chromium' | 754 project_name = project_name or 'Chromium' |
757 license_header = license_header or ( | 755 license_header = license_header or ( |
758 r'.*? Copyright \(c\) %(year)s The %(project)s Authors\. ' | 756 r'.*? Copyright \(c\) %(year)s The %(project)s Authors\. ' |
759 r'All rights reserved\.\n' | 757 r'All rights reserved\.\n' |
760 r'.*? Use of this source code is governed by a BSD-style license that ' | 758 r'.*? Use of this source code is governed by a BSD-style license that ' |
761 r'can be\n' | 759 r'can be\n' |
762 r'.*? found in the LICENSE file\.\n' | 760 r'.*? found in the LICENSE file\.\n' |
763 ) % { | 761 ) % { |
764 'year': time.strftime('%Y'), | 762 'year': input_api.time.strftime('%Y'), |
765 'project': project_name, | 763 'project': project_name, |
766 } | 764 } |
767 | 765 |
768 results = [] | 766 results = [] |
769 # This code loads the default black list (e.g. third_party, experimental, etc) | 767 # This code loads the default black list (e.g. third_party, experimental, etc) |
770 # and add our black list (breakpad, skia and v8 are still not following | 768 # and add our black list (breakpad, skia and v8 are still not following |
771 # google style and are not really living this repository). | 769 # google style and are not really living this repository). |
772 # See presubmit_support.py InputApi.FilterSourceFile for the (simple) usage. | 770 # See presubmit_support.py InputApi.FilterSourceFile for the (simple) usage. |
773 black_list = input_api.DEFAULT_BLACK_LIST + excluded_paths | 771 black_list = input_api.DEFAULT_BLACK_LIST + excluded_paths |
774 white_list = input_api.DEFAULT_WHITE_LIST + text_files | 772 white_list = input_api.DEFAULT_WHITE_LIST + text_files |
(...skipping 16 matching lines...) Expand all Loading... |
791 input_api, output_api, source_file_filter=text_files)) | 789 input_api, output_api, source_file_filter=text_files)) |
792 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 790 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
793 input_api, output_api)) | 791 input_api, output_api)) |
794 results.extend(input_api.canned_checks.CheckLicense( | 792 results.extend(input_api.canned_checks.CheckLicense( |
795 input_api, output_api, license_header, source_file_filter=sources)) | 793 input_api, output_api, license_header, source_file_filter=sources)) |
796 results.extend(_CheckConstNSObject( | 794 results.extend(_CheckConstNSObject( |
797 input_api, output_api, source_file_filter=sources)) | 795 input_api, output_api, source_file_filter=sources)) |
798 results.extend(_CheckSingletonInHeaders( | 796 results.extend(_CheckSingletonInHeaders( |
799 input_api, output_api, source_file_filter=sources)) | 797 input_api, output_api, source_file_filter=sources)) |
800 return results | 798 return results |
OLD | NEW |