Skip to content

Commit

Permalink
Add a couple of things to the whitelist as requested. Refactor.
Browse files Browse the repository at this point in the history
BUG=none
TEST=none


Review URL: http://codereview.chromium.org/8355017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106455 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
joi@chromium.org committed Oct 20, 2011
1 parent e29a92a commit 19e77fd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api):
# calls to such functions without a proper C++ parser.
source_extensions = r'\.(cc|cpp|cxx|mm)$'
file_inclusion_pattern = r'.+%s' % source_extensions
file_exclusion_pattern = (
r'(.*/(test_|mock_).+|.+(_test_support|profile_sync_service_harness|'
r'_(api|browser|perf|unit|ui)?test))%s' % source_extensions)
path_exclusion_pattern = r'.*[/\\](test|tool(s)?)[/\\].*'
file_exclusion_patterns = (
r'.*/(test_|mock_).+%s' % source_extensions,
r'.+_test_(support|base)%s' % source_extensions,
r'.+_(api|browser|perf|unit|ui)?test%s' % source_extensions,
r'.+profile_sync_service_harness%s' % source_extensions,
)
path_exclusion_patterns = (
r'.*[/\\](test|tool(s)?)[/\\].*',
# At request of folks maintaining this folder.
r'chrome[/\\]browser[/\\]automation[/\\].*',
)

base_function_pattern = r'ForTest(ing)?|for_test(ing)?'
inclusion_pattern = input_api.re.compile(r'(%s)\s*\(' % base_function_pattern)
Expand All @@ -60,7 +67,7 @@ def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api):
base_function_pattern, base_function_pattern))

def FilterFile(affected_file):
black_list = ((file_exclusion_pattern, path_exclusion_pattern, ) +
black_list = (file_exclusion_patterns + path_exclusion_patterns +
_EXCLUDED_PATHS + input_api.DEFAULT_BLACK_LIST)
return input_api.FilterSourceFile(
affected_file,
Expand Down

0 comments on commit 19e77fd

Please sign in to comment.