Chromium Code Reviews| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 if not histogram_name_found: | 464 if not histogram_name_found: |
| 465 problems.append(' [%s:%d] %s' % | 465 problems.append(' [%s:%d] %s' % |
| 466 (f.LocalPath(), line_num, histogram_name)) | 466 (f.LocalPath(), line_num, histogram_name)) |
| 467 | 467 |
| 468 if not problems: | 468 if not problems: |
| 469 return [] | 469 return [] |
| 470 return [output_api.PresubmitPromptWarning('Some UMA_HISTOGRAM lines have ' | 470 return [output_api.PresubmitPromptWarning('Some UMA_HISTOGRAM lines have ' |
| 471 'been modified and the associated histogram name has no match in either ' | 471 'been modified and the associated histogram name has no match in either ' |
| 472 '%s or the modifications of it:' % (histograms_xml_path), problems)] | 472 '%s or the modifications of it:' % (histograms_xml_path), problems)] |
| 473 | 473 |
| 474 def _CheckFlakyTestUsage(input_api, output_api): | |
| 475 """Check that FlakyTest annotation is our own instead of the android one""" | |
| 476 pattern = input_api.re.compile(r'import android.test.FlakyTest;') | |
| 477 files = [] | |
| 478 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): | |
| 479 if (f.LocalPath().endswith('Test.java')): | |
|
rnephew (Reviews Here)
2016/04/11 18:58:26
nit:
if (f.LocalPath().endswith('Test.java')):
i
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
| |
| 480 contents = input_api.ReadFile(f) | |
| 481 if pattern.search(contents): | |
|
rnephew (Reviews Here)
2016/04/11 18:58:26
Since contents isn't used elsewhere, you could pro
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
| |
| 482 files.append(f) | |
| 483 if len(files): | |
| 484 return [ output_api.PresubmitError( | |
|
rnephew (Reviews Here)
2016/04/11 18:56:30
nit: [output_api...
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
| |
| 485 'Use org.chromium.base.test.util.FlakyTest instead of ' + | |
|
rnephew (Reviews Here)
2016/04/11 18:56:30
nit: 4 space indentation.
no need for + here. Thi
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
| |
| 486 'android.test.FlakyTest', | |
| 487 files) ] | |
|
rnephew (Reviews Here)
2016/04/11 18:56:30
nit: files)]
Yoland Yan(Google)
2016/04/11 19:03:44
Done.
| |
| 488 return [] | |
| 474 | 489 |
| 475 def _CheckNoNewWStrings(input_api, output_api): | 490 def _CheckNoNewWStrings(input_api, output_api): |
| 476 """Checks to make sure we don't introduce use of wstrings.""" | 491 """Checks to make sure we don't introduce use of wstrings.""" |
| 477 problems = [] | 492 problems = [] |
| 478 for f in input_api.AffectedFiles(): | 493 for f in input_api.AffectedFiles(): |
| 479 if (not f.LocalPath().endswith(('.cc', '.h')) or | 494 if (not f.LocalPath().endswith(('.cc', '.h')) or |
| 480 f.LocalPath().endswith(('test.cc', '_win.cc', '_win.h')) or | 495 f.LocalPath().endswith(('test.cc', '_win.cc', '_win.h')) or |
| 481 '/win/' in f.LocalPath()): | 496 '/win/' in f.LocalPath()): |
| 482 continue | 497 continue |
| 483 | 498 |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1787 results.extend(_CheckUnwantedDependencies(input_api, output_api)) | 1802 results.extend(_CheckUnwantedDependencies(input_api, output_api)) |
| 1788 results.extend(_CheckFilePermissions(input_api, output_api)) | 1803 results.extend(_CheckFilePermissions(input_api, output_api)) |
| 1789 results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api)) | 1804 results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api)) |
| 1790 results.extend(_CheckIncludeOrder(input_api, output_api)) | 1805 results.extend(_CheckIncludeOrder(input_api, output_api)) |
| 1791 results.extend(_CheckForVersionControlConflicts(input_api, output_api)) | 1806 results.extend(_CheckForVersionControlConflicts(input_api, output_api)) |
| 1792 results.extend(_CheckPatchFiles(input_api, output_api)) | 1807 results.extend(_CheckPatchFiles(input_api, output_api)) |
| 1793 results.extend(_CheckHardcodedGoogleHostsInLowerLayers(input_api, output_api)) | 1808 results.extend(_CheckHardcodedGoogleHostsInLowerLayers(input_api, output_api)) |
| 1794 results.extend(_CheckNoAbbreviationInPngFileName(input_api, output_api)) | 1809 results.extend(_CheckNoAbbreviationInPngFileName(input_api, output_api)) |
| 1795 results.extend(_CheckForInvalidOSMacros(input_api, output_api)) | 1810 results.extend(_CheckForInvalidOSMacros(input_api, output_api)) |
| 1796 results.extend(_CheckForInvalidIfDefinedMacros(input_api, output_api)) | 1811 results.extend(_CheckForInvalidIfDefinedMacros(input_api, output_api)) |
| 1812 results.extend(_CheckFlakyTestUsage(input_api, output_api)) | |
| 1797 # TODO(danakj): Remove this when base/move.h is removed. | 1813 # TODO(danakj): Remove this when base/move.h is removed. |
| 1798 results.extend(_CheckForUsingPass(input_api, output_api)) | 1814 results.extend(_CheckForUsingPass(input_api, output_api)) |
| 1799 results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api)) | 1815 results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api)) |
| 1800 results.extend( | 1816 results.extend( |
| 1801 input_api.canned_checks.CheckChangeHasNoTabs( | 1817 input_api.canned_checks.CheckChangeHasNoTabs( |
| 1802 input_api, | 1818 input_api, |
| 1803 output_api, | 1819 output_api, |
| 1804 source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) | 1820 source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) |
| 1805 results.extend(_CheckSpamLogging(input_api, output_api)) | 1821 results.extend(_CheckSpamLogging(input_api, output_api)) |
| 1806 results.extend(_CheckForAnonymousVariables(input_api, output_api)) | 1822 results.extend(_CheckForAnonymousVariables(input_api, output_api)) |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2089 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 2105 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 2090 input_api, | 2106 input_api, |
| 2091 output_api, | 2107 output_api, |
| 2092 json_url='http://chromium-status.appspot.com/current?format=json')) | 2108 json_url='http://chromium-status.appspot.com/current?format=json')) |
| 2093 | 2109 |
| 2094 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 2110 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
| 2095 input_api, output_api)) | 2111 input_api, output_api)) |
| 2096 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 2112 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 2097 input_api, output_api)) | 2113 input_api, output_api)) |
| 2098 return results | 2114 return results |
| OLD | NEW |