Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: PRESUBMIT.py

Issue 7980032: Fix false positive that occurred because _test.cc files were not (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 that ignores header files and may have some false positives. A 43 that ignores header files and may have some false positives. A
44 better implementation would probably need a proper C++ parser. 44 better implementation would probably need a proper C++ parser.
45 """ 45 """
46 # We only scan .cc files and the like, as the declaration of 46 # We only scan .cc files and the like, as the declaration of
47 # for-testing functions in header files are hard to distinguish from 47 # for-testing functions in header files are hard to distinguish from
48 # calls to such functions without a proper C++ parser. 48 # calls to such functions without a proper C++ parser.
49 source_extensions = r'\.(cc|cpp|cxx|mm)$' 49 source_extensions = r'\.(cc|cpp|cxx|mm)$'
50 file_inclusion_pattern = r'.+%s' % source_extensions 50 file_inclusion_pattern = r'.+%s' % source_extensions
51 file_exclusion_pattern = ( 51 file_exclusion_pattern = (
52 r'.+(_test_support|profile_sync_service_harness|' 52 r'.+(_test_support|profile_sync_service_harness|'
53 r'_(unit|browser|ui|perf)test)%s' % 53 r'_(api|browser|perf|unit|ui)?test)%s' % source_extensions)
54 source_extensions)
55 path_exclusion_pattern = r'.*[/\\](test|tool(s)?)[/\\].*' 54 path_exclusion_pattern = r'.*[/\\](test|tool(s)?)[/\\].*'
56 55
57 base_function_pattern = r'ForTest(ing)?|for_test(ing)?' 56 base_function_pattern = r'ForTest(ing)?|for_test(ing)?'
58 inclusion_pattern = input_api.re.compile(r'(%s)\s*\(' % base_function_pattern) 57 inclusion_pattern = input_api.re.compile(r'(%s)\s*\(' % base_function_pattern)
59 exclusion_pattern = input_api.re.compile( 58 exclusion_pattern = input_api.re.compile(
60 r'::[A-Za-z0-9_]+(%s)|(%s)[^;]+\{' % ( 59 r'::[A-Za-z0-9_]+(%s)|(%s)[^;]+\{' % (
61 base_function_pattern, base_function_pattern)) 60 base_function_pattern, base_function_pattern))
62 61
63 def FilterFile(affected_file): 62 def FilterFile(affected_file):
64 black_list = ((file_exclusion_pattern, path_exclusion_pattern, ) + 63 black_list = ((file_exclusion_pattern, path_exclusion_pattern, ) +
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 results.extend(input_api.canned_checks.CheckChangeHasBugField( 239 results.extend(input_api.canned_checks.CheckChangeHasBugField(
241 input_api, output_api)) 240 input_api, output_api))
242 results.extend(input_api.canned_checks.CheckChangeHasTestField( 241 results.extend(input_api.canned_checks.CheckChangeHasTestField(
243 input_api, output_api)) 242 input_api, output_api))
244 results.extend(_CheckSubversionConfig(input_api, output_api)) 243 results.extend(_CheckSubversionConfig(input_api, output_api))
245 return results 244 return results
246 245
247 246
248 def GetPreferredTrySlaves(): 247 def GetPreferredTrySlaves():
249 return ['win', 'linux', 'mac'] 248 return ['win', 'linux', 'mac']
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698