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 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 fp.close() | 2029 fp.close() |
2030 | 2030 |
2031 if problems: | 2031 if problems: |
2032 return [output_api.PresubmitPromptWarning('Are you sure that you want ' | 2032 return [output_api.PresubmitPromptWarning('Are you sure that you want ' |
2033 'these files to contain Windows style line endings?\n' + | 2033 'these files to contain Windows style line endings?\n' + |
2034 '\n'.join(problems))] | 2034 '\n'.join(problems))] |
2035 | 2035 |
2036 return [] | 2036 return [] |
2037 | 2037 |
2038 | 2038 |
| 2039 def _CheckSyslogUseWarning(input_api, output_api, source_file_filter=None, |
| 2040 lint_filters=None, verbose_level=None): |
| 2041 """Checks that all source files use SYSLOG properly.""" |
| 2042 syslog_files = [] |
| 2043 for f in input_api.AffectedSourceFiles(source_file_filter): |
| 2044 if 'SYSLOG' in input_api.ReadFile(f, 'rb'): |
| 2045 syslog_files.append(f.LocalPath()) |
| 2046 if syslog_files: |
| 2047 return [output_api.PresubmitPromptWarning( |
| 2048 'Please make sure there are no privacy sensitive bits of data in SYSLOG' |
| 2049 ' calls.\nFiles to check:\n', items=syslog_files)] |
| 2050 return [] |
| 2051 |
| 2052 |
2039 def CheckChangeOnUpload(input_api, output_api): | 2053 def CheckChangeOnUpload(input_api, output_api): |
2040 results = [] | 2054 results = [] |
2041 results.extend(_CommonChecks(input_api, output_api)) | 2055 results.extend(_CommonChecks(input_api, output_api)) |
2042 results.extend(_CheckValidHostsInDEPS(input_api, output_api)) | 2056 results.extend(_CheckValidHostsInDEPS(input_api, output_api)) |
2043 results.extend(_CheckJavaStyle(input_api, output_api)) | 2057 results.extend(_CheckJavaStyle(input_api, output_api)) |
2044 results.extend( | 2058 results.extend( |
2045 input_api.canned_checks.CheckGNFormatted(input_api, output_api)) | 2059 input_api.canned_checks.CheckGNFormatted(input_api, output_api)) |
2046 results.extend(_CheckUmaHistogramChanges(input_api, output_api)) | 2060 results.extend(_CheckUmaHistogramChanges(input_api, output_api)) |
2047 results.extend(_AndroidSpecificOnUploadChecks(input_api, output_api)) | 2061 results.extend(_AndroidSpecificOnUploadChecks(input_api, output_api)) |
| 2062 results.extend(_CheckSyslogUseWarning(input_api, output_api)) |
2048 return results | 2063 return results |
2049 | 2064 |
2050 | 2065 |
2051 def GetTryServerMasterForBot(bot): | 2066 def GetTryServerMasterForBot(bot): |
2052 """Returns the Try Server master for the given bot. | 2067 """Returns the Try Server master for the given bot. |
2053 | 2068 |
2054 It tries to guess the master from the bot name, but may still fail | 2069 It tries to guess the master from the bot name, but may still fail |
2055 and return None. There is no longer a default master. | 2070 and return None. There is no longer a default master. |
2056 """ | 2071 """ |
2057 # Potentially ambiguous bot names are listed explicitly. | 2072 # Potentially ambiguous bot names are listed explicitly. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 2105 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
2091 input_api, | 2106 input_api, |
2092 output_api, | 2107 output_api, |
2093 json_url='http://chromium-status.appspot.com/current?format=json')) | 2108 json_url='http://chromium-status.appspot.com/current?format=json')) |
2094 | 2109 |
2095 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 2110 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
2096 input_api, output_api)) | 2111 input_api, output_api)) |
2097 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 2112 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
2098 input_api, output_api)) | 2113 input_api, output_api)) |
2099 return results | 2114 return results |
OLD | NEW |