| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 | 5 |
| 6 """Top-level presubmit script for Skia. | 6 """Top-level presubmit script for Skia. |
| 7 | 7 |
| 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 9 for more details about the presubmit API built into gcl. | 9 for more details about the presubmit API built into gcl. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 import os | 12 import os |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 | 15 |
| 16 SKIA_TREE_STATUS_URL = 'http://skia-tree-status.appspot.com' | 16 SKIA_TREE_STATUS_URL = 'http://skia-tree-status.appspot.com' |
| 17 | 17 |
| 18 PUBLIC_API_OWNERS = ( | 18 PUBLIC_API_OWNERS = ( |
| 19 'reed@chromium.org', | 19 'reed@chromium.org', |
| 20 'reed@google.com', | 20 'reed@google.com', |
| 21 'bsalomon@chromium.org', | 21 'bsalomon@chromium.org', |
| 22 'bsalomon@google.com', | 22 'bsalomon@google.com', |
| 23 'rmistry@google.com', # For emergency reverts only. |
| 23 ) | 24 ) |
| 24 | 25 |
| 25 | 26 |
| 26 def _CheckChangeHasEol(input_api, output_api, source_file_filter=None): | 27 def _CheckChangeHasEol(input_api, output_api, source_file_filter=None): |
| 27 """Checks that files end with atleast one \n (LF).""" | 28 """Checks that files end with atleast one \n (LF).""" |
| 28 eof_files = [] | 29 eof_files = [] |
| 29 for f in input_api.AffectedSourceFiles(source_file_filter): | 30 for f in input_api.AffectedSourceFiles(source_file_filter): |
| 30 contents = input_api.ReadFile(f, 'rb') | 31 contents = input_api.ReadFile(f, 'rb') |
| 31 # Check that the file ends in atleast one newline character. | 32 # Check that the file ends in atleast one newline character. |
| 32 if len(contents) > 1 and contents[-1:] != '\n': | 33 if len(contents) > 1 and contents[-1:] != '\n': |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 http://skia-tree-status.appspot.com/. Shows a warning if it is in 'Caution' | 157 http://skia-tree-status.appspot.com/. Shows a warning if it is in 'Caution' |
| 157 state and an error if it is in 'Closed' state. | 158 state and an error if it is in 'Closed' state. |
| 158 """ | 159 """ |
| 159 results = [] | 160 results = [] |
| 160 results.extend(_CommonChecks(input_api, output_api)) | 161 results.extend(_CommonChecks(input_api, output_api)) |
| 161 results.extend( | 162 results.extend( |
| 162 _CheckTreeStatus(input_api, output_api, json_url=( | 163 _CheckTreeStatus(input_api, output_api, json_url=( |
| 163 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) | 164 SKIA_TREE_STATUS_URL + '/banner-status?format=json'))) |
| 164 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) | 165 results.extend(_CheckLGTMsForPublicAPI(input_api, output_api)) |
| 165 return results | 166 return results |
| OLD | NEW |