Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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'_(unit|browser|ui|perf)?test)%s' % source_extensions) |
|
Paweł Hajdan Jr.
2011/09/21 17:19:42
nit: While you're here, it's probably worth to add
Jói
2011/09/21 20:30:20
Done.
| |
| 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 Loading... | |
| 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'] |
| OLD | NEW |