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 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 '\n'.join(problems))] | 2271 '\n'.join(problems))] |
2272 | 2272 |
2273 return [] | 2273 return [] |
2274 | 2274 |
2275 | 2275 |
2276 def _CheckSyslogUseWarning(input_api, output_api, source_file_filter=None, | 2276 def _CheckSyslogUseWarning(input_api, output_api, source_file_filter=None, |
2277 lint_filters=None, verbose_level=None): | 2277 lint_filters=None, verbose_level=None): |
2278 """Checks that all source files use SYSLOG properly.""" | 2278 """Checks that all source files use SYSLOG properly.""" |
2279 syslog_files = [] | 2279 syslog_files = [] |
2280 for f in input_api.AffectedSourceFiles(source_file_filter): | 2280 for f in input_api.AffectedSourceFiles(source_file_filter): |
2281 if 'SYSLOG' in input_api.ReadFile(f, 'rb'): | 2281 for line_number, line in f.ChangedContents(): |
2282 syslog_files.append(f.LocalPath()) | 2282 if 'SYSLOG' in line: |
| 2283 syslog_files.append(f.LocalPath() + ':' + str(line_number)) |
| 2284 |
2283 if syslog_files: | 2285 if syslog_files: |
2284 return [output_api.PresubmitPromptWarning( | 2286 return [output_api.PresubmitPromptWarning( |
2285 'Please make sure there are no privacy sensitive bits of data in SYSLOG' | 2287 'Please make sure there are no privacy sensitive bits of data in SYSLOG' |
2286 ' calls.\nFiles to check:\n', items=syslog_files)] | 2288 ' calls.\nFiles to check:\n', items=syslog_files)] |
2287 return [] | 2289 return [] |
2288 | 2290 |
2289 | 2291 |
2290 def CheckChangeOnUpload(input_api, output_api): | 2292 def CheckChangeOnUpload(input_api, output_api): |
2291 results = [] | 2293 results = [] |
2292 results.extend(_CommonChecks(input_api, output_api)) | 2294 results.extend(_CommonChecks(input_api, output_api)) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2343 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 2345 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
2344 input_api, | 2346 input_api, |
2345 output_api, | 2347 output_api, |
2346 json_url='http://chromium-status.appspot.com/current?format=json')) | 2348 json_url='http://chromium-status.appspot.com/current?format=json')) |
2347 | 2349 |
2348 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 2350 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
2349 input_api, output_api)) | 2351 input_api, output_api)) |
2350 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 2352 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
2351 input_api, output_api)) | 2353 input_api, output_api)) |
2352 return results | 2354 return results |
OLD | NEW |