| 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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 errors = [] | 968 errors = [] |
| 969 for f in input_api.AffectedFiles(): | 969 for f in input_api.AffectedFiles(): |
| 970 errors.extend(_CheckForVersionControlConflictsInFile(input_api, f)) | 970 errors.extend(_CheckForVersionControlConflictsInFile(input_api, f)) |
| 971 | 971 |
| 972 results = [] | 972 results = [] |
| 973 if errors: | 973 if errors: |
| 974 results.append(output_api.PresubmitError( | 974 results.append(output_api.PresubmitError( |
| 975 'Version control conflict markers found, please resolve.', errors)) | 975 'Version control conflict markers found, please resolve.', errors)) |
| 976 return results | 976 return results |
| 977 | 977 |
| 978 def _CheckGoogleSupportAnswerUrl(input_api, output_api): |
| 979 pattern = input_api.re.compile('support\.google\.com\/chrome.*/answer') |
| 980 errors = [] |
| 981 for f in input_api.AffectedFiles(): |
| 982 for line_num, line in f.ChangedContents(): |
| 983 if pattern.search(line): |
| 984 errors.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) |
| 985 |
| 986 results = [] |
| 987 if errors: |
| 988 results.append(output_api.PresubmitPromptWarning( |
| 989 'Found Google support URL addressed by answer number. Please replace with
' |
| 990 'a p= identifier instead. See crbug.com/679462\n', errors)) |
| 991 return results |
| 992 |
| 978 | 993 |
| 979 def _CheckHardcodedGoogleHostsInLowerLayers(input_api, output_api): | 994 def _CheckHardcodedGoogleHostsInLowerLayers(input_api, output_api): |
| 980 def FilterFile(affected_file): | 995 def FilterFile(affected_file): |
| 981 """Filter function for use with input_api.AffectedSourceFiles, | 996 """Filter function for use with input_api.AffectedSourceFiles, |
| 982 below. This filters out everything except non-test files from | 997 below. This filters out everything except non-test files from |
| 983 top-level directories that generally speaking should not hard-code | 998 top-level directories that generally speaking should not hard-code |
| 984 service URLs (e.g. src/android_webview/, src/content/ and others). | 999 service URLs (e.g. src/android_webview/, src/content/ and others). |
| 985 """ | 1000 """ |
| 986 return input_api.FilterSourceFile( | 1001 return input_api.FilterSourceFile( |
| 987 affected_file, | 1002 affected_file, |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2289 | 2304 |
| 2290 def CheckChangeOnUpload(input_api, output_api): | 2305 def CheckChangeOnUpload(input_api, output_api): |
| 2291 results = [] | 2306 results = [] |
| 2292 results.extend(_CommonChecks(input_api, output_api)) | 2307 results.extend(_CommonChecks(input_api, output_api)) |
| 2293 results.extend(_CheckValidHostsInDEPS(input_api, output_api)) | 2308 results.extend(_CheckValidHostsInDEPS(input_api, output_api)) |
| 2294 results.extend( | 2309 results.extend( |
| 2295 input_api.canned_checks.CheckGNFormatted(input_api, output_api)) | 2310 input_api.canned_checks.CheckGNFormatted(input_api, output_api)) |
| 2296 results.extend(_CheckUmaHistogramChanges(input_api, output_api)) | 2311 results.extend(_CheckUmaHistogramChanges(input_api, output_api)) |
| 2297 results.extend(_AndroidSpecificOnUploadChecks(input_api, output_api)) | 2312 results.extend(_AndroidSpecificOnUploadChecks(input_api, output_api)) |
| 2298 results.extend(_CheckSyslogUseWarning(input_api, output_api)) | 2313 results.extend(_CheckSyslogUseWarning(input_api, output_api)) |
| 2314 results.extend(_CheckGoogleSupportAnswerUrl(input_api, output_api)) |
| 2299 return results | 2315 return results |
| 2300 | 2316 |
| 2301 | 2317 |
| 2302 def GetTryServerMasterForBot(bot): | 2318 def GetTryServerMasterForBot(bot): |
| 2303 """Returns the Try Server master for the given bot. | 2319 """Returns the Try Server master for the given bot. |
| 2304 | 2320 |
| 2305 It tries to guess the master from the bot name, but may still fail | 2321 It tries to guess the master from the bot name, but may still fail |
| 2306 and return None. There is no longer a default master. | 2322 and return None. There is no longer a default master. |
| 2307 """ | 2323 """ |
| 2308 # Potentially ambiguous bot names are listed explicitly. | 2324 # Potentially ambiguous bot names are listed explicitly. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2343 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 2359 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 2344 input_api, | 2360 input_api, |
| 2345 output_api, | 2361 output_api, |
| 2346 json_url='http://chromium-status.appspot.com/current?format=json')) | 2362 json_url='http://chromium-status.appspot.com/current?format=json')) |
| 2347 | 2363 |
| 2348 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 2364 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
| 2349 input_api, output_api)) | 2365 input_api, output_api)) |
| 2350 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 2366 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 2351 input_api, output_api)) | 2367 input_api, output_api)) |
| 2352 return results | 2368 return results |
| OLD | NEW |