| 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 gcl. |     8 for more details about the presubmit API built into gcl. | 
|     9 """ |     9 """ | 
|    10  |    10  | 
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1275   for fpath in input_api.AffectedFiles(file_filter=file_filter): |  1275   for fpath in input_api.AffectedFiles(file_filter=file_filter): | 
|  1276     for lnum, line in fpath.ChangedContents(): |  1276     for lnum, line in fpath.ChangedContents(): | 
|  1277       for (deprecated, replacement) in _DEPRECATED_JS: |  1277       for (deprecated, replacement) in _DEPRECATED_JS: | 
|  1278         if deprecated in line: |  1278         if deprecated in line: | 
|  1279           results.append(output_api.PresubmitError( |  1279           results.append(output_api.PresubmitError( | 
|  1280               "%s:%d: Use of deprecated JS %s, use %s instead" % |  1280               "%s:%d: Use of deprecated JS %s, use %s instead" % | 
|  1281               (fpath.LocalPath(), lnum, deprecated, replacement))) |  1281               (fpath.LocalPath(), lnum, deprecated, replacement))) | 
|  1282   return results |  1282   return results | 
|  1283  |  1283  | 
|  1284  |  1284  | 
|  1285 def _CheckForOverrideAndFinalRules(input_api, output_api): |  | 
|  1286   """Checks for final and override used as per C++11""" |  | 
|  1287   problems = [] |  | 
|  1288   for f in input_api.AffectedFiles(): |  | 
|  1289     if (f.LocalPath().endswith(('.cc', '.cpp', '.h', '.mm'))): |  | 
|  1290       for line_num, line in f.ChangedContents(): |  | 
|  1291         if (input_api.re.search(r'\b(FINAL|OVERRIDE)\b', line)): |  | 
|  1292           problems.append('    %s:%d' % (f.LocalPath(), line_num)) |  | 
|  1293  |  | 
|  1294   if not problems: |  | 
|  1295     return [] |  | 
|  1296   return [output_api.PresubmitError('Use C++11\'s |final| and |override| ' |  | 
|  1297                                     'rather than FINAL and OVERRIDE.', |  | 
|  1298                                     problems)] |  | 
|  1299  |  | 
|  1300  |  | 
|  1301 def _CommonChecks(input_api, output_api): |  1285 def _CommonChecks(input_api, output_api): | 
|  1302   """Checks common to both upload and commit.""" |  1286   """Checks common to both upload and commit.""" | 
|  1303   results = [] |  1287   results = [] | 
|  1304   results.extend(input_api.canned_checks.PanProjectChecks( |  1288   results.extend(input_api.canned_checks.PanProjectChecks( | 
|  1305       input_api, output_api, |  1289       input_api, output_api, | 
|  1306       excluded_paths=_EXCLUDED_PATHS + _TESTRUNNER_PATHS)) |  1290       excluded_paths=_EXCLUDED_PATHS + _TESTRUNNER_PATHS)) | 
|  1307   results.extend(_CheckAuthorizedAuthor(input_api, output_api)) |  1291   results.extend(_CheckAuthorizedAuthor(input_api, output_api)) | 
|  1308   results.extend( |  1292   results.extend( | 
|  1309       _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) |  1293       _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) | 
|  1310   results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) |  1294   results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
|  1333           output_api, |  1317           output_api, | 
|  1334           source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) |  1318           source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) | 
|  1335   results.extend(_CheckSpamLogging(input_api, output_api)) |  1319   results.extend(_CheckSpamLogging(input_api, output_api)) | 
|  1336   results.extend(_CheckForAnonymousVariables(input_api, output_api)) |  1320   results.extend(_CheckForAnonymousVariables(input_api, output_api)) | 
|  1337   results.extend(_CheckCygwinShell(input_api, output_api)) |  1321   results.extend(_CheckCygwinShell(input_api, output_api)) | 
|  1338   results.extend(_CheckUserActionUpdate(input_api, output_api)) |  1322   results.extend(_CheckUserActionUpdate(input_api, output_api)) | 
|  1339   results.extend(_CheckNoDeprecatedCSS(input_api, output_api)) |  1323   results.extend(_CheckNoDeprecatedCSS(input_api, output_api)) | 
|  1340   results.extend(_CheckNoDeprecatedJS(input_api, output_api)) |  1324   results.extend(_CheckNoDeprecatedJS(input_api, output_api)) | 
|  1341   results.extend(_CheckParseErrors(input_api, output_api)) |  1325   results.extend(_CheckParseErrors(input_api, output_api)) | 
|  1342   results.extend(_CheckForIPCRules(input_api, output_api)) |  1326   results.extend(_CheckForIPCRules(input_api, output_api)) | 
|  1343   results.extend(_CheckForOverrideAndFinalRules(input_api, output_api)) |  | 
|  1344  |  1327  | 
|  1345   if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): |  1328   if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): | 
|  1346     results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |  1329     results.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 
|  1347         input_api, output_api, |  1330         input_api, output_api, | 
|  1348         input_api.PresubmitLocalPath(), |  1331         input_api.PresubmitLocalPath(), | 
|  1349         whitelist=[r'^PRESUBMIT_test\.py$'])) |  1332         whitelist=[r'^PRESUBMIT_test\.py$'])) | 
|  1350   return results |  1333   return results | 
|  1351  |  1334  | 
|  1352  |  1335  | 
|  1353 def _CheckAuthorizedAuthor(input_api, output_api): |  1336 def _CheckAuthorizedAuthor(input_api, output_api): | 
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1756     builders.extend(['cros_x86']) |  1739     builders.extend(['cros_x86']) | 
|  1757  |  1740  | 
|  1758   # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |  1741   # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 
|  1759   # unless they're .gyp(i) files as changes to those files can break the gyp |  1742   # unless they're .gyp(i) files as changes to those files can break the gyp | 
|  1760   # step on that bot. |  1743   # step on that bot. | 
|  1761   if (not all(re.search('^chrome', f) for f in files) or |  1744   if (not all(re.search('^chrome', f) for f in files) or | 
|  1762       any(re.search('\.gypi?$', f) for f in files)): |  1745       any(re.search('\.gypi?$', f) for f in files)): | 
|  1763     builders.extend(['android_aosp']) |  1746     builders.extend(['android_aosp']) | 
|  1764  |  1747  | 
|  1765   return GetDefaultTryConfigs(builders) |  1748   return GetDefaultTryConfigs(builders) | 
| OLD | NEW |