OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The LUCI 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 under the Apache License, Version 2.0 |
3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 """Top-level presubmit script. | 5 """Top-level presubmit script. |
6 | 6 |
7 See https://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See https://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
8 details on the presubmit API built into depot_tools. | 8 details on the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
11 import os | 11 import os |
12 import sys | 12 import sys |
13 | 13 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 message=error_type), | 47 message=error_type), |
48 ]) | 48 ]) |
49 | 49 |
50 | 50 |
51 def header(input_api): | 51 def header(input_api): |
52 """Returns the expected license header regexp for this project.""" | 52 """Returns the expected license header regexp for this project.""" |
53 current_year = int(input_api.time.strftime('%Y')) | 53 current_year = int(input_api.time.strftime('%Y')) |
54 allowed_years = (str(s) for s in reversed(xrange(2011, current_year + 1))) | 54 allowed_years = (str(s) for s in reversed(xrange(2011, current_year + 1))) |
55 years_re = '(' + '|'.join(allowed_years) + ')' | 55 years_re = '(' + '|'.join(allowed_years) + ')' |
56 license_header = ( | 56 license_header = ( |
57 r'.*? Copyright %(year)s The Chromium Authors\. ' | 57 r'.*? Copyright %(year)s The LUCI Authors\. ' |
58 r'All rights reserved\.\n' | 58 r'All rights reserved\.\n' |
59 r'.*? Use of this source code is governed by a BSD-style license ' | 59 r'.*? Use of this source code is governed under the Apache License, ' |
60 r'that can be\n' | 60 r'Version 2\.0\n' |
61 r'.*? found in the LICENSE file\.(?: \*/)?\n' | 61 r'.*? that can be found in the LICENSE file\.(?: \*/)?\n' |
62 ) % { | 62 ) % { |
63 'year': years_re, | 63 'year': years_re, |
64 } | 64 } |
65 return license_header | 65 return license_header |
66 | 66 |
67 | 67 |
68 def source_file_filter(input_api): | 68 def source_file_filter(input_api): |
69 """Returns filter that selects source code files only.""" | 69 """Returns filter that selects source code files only.""" |
70 bl = list(input_api.DEFAULT_BLACK_LIST) + [ | 70 bl = list(input_api.DEFAULT_BLACK_LIST) + [ |
71 r'.+\.pb\.go$', | 71 r'.+\.pb\.go$', |
(...skipping 28 matching lines...) Expand all Loading... |
100 results = CommonChecks(input_api, output_api) | 100 results = CommonChecks(input_api, output_api) |
101 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 101 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
102 input_api, output_api)) | 102 input_api, output_api)) |
103 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( | 103 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( |
104 input_api, output_api)) | 104 input_api, output_api)) |
105 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( | 105 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( |
106 input_api, output_api)) | 106 input_api, output_api)) |
107 results.extend(PreCommitGo( | 107 results.extend(PreCommitGo( |
108 input_api, output_api, ['lint', 'pre-commit', 'pre-push'])) | 108 input_api, output_api, ['lint', 'pre-commit', 'pre-push'])) |
109 return results | 109 return results |
OLD | NEW |