summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 14:31:49 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 14:31:49 +0000
commit7345da0de3a7d937509579175cf77df83353ec3e (patch)
tree7f95c55d79f6815ec400fffdc00a967745c48c1b /PRESUBMIT.py
parent565c6303f6c7895d55536e5fb717a8dc6f815ffe (diff)
downloadchromium_src-7345da0de3a7d937509579175cf77df83353ec3e.zip
chromium_src-7345da0de3a7d937509579175cf77df83353ec3e.tar.gz
chromium_src-7345da0de3a7d937509579175cf77df83353ec3e.tar.bz2
Add support for excluding individual paths (matching a pattern) from the banned CPP functions check
Also add shell_browser_main.cc to the list of excluded paths for the ScopedAllowIO object. This file does the setup for layout tests which requires a fair number of IO. BUG=none R=joi@chromium.org Review URL: https://codereview.chromium.org/11419182 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169657 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index e9c4212..515b48c 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -129,6 +129,7 @@ _BANNED_CPP_FUNCTIONS = (
'base/gtest_prod_util.h and use FRIEND_TEST_ALL_PREFIXES() instead.',
),
False,
+ (),
),
(
'ScopedAllowIO',
@@ -137,6 +138,9 @@ _BANNED_CPP_FUNCTIONS = (
'pool or the FILE thread instead.',
),
True,
+ (
+ r"^content[\\\/]shell[\\\/]shell_browser_main\.cc$",
+ ),
),
(
'FilePathWatcher::Delegate',
@@ -145,6 +149,7 @@ _BANNED_CPP_FUNCTIONS = (
'interface instead.',
),
False,
+ (),
),
(
'browser::FindAnyBrowser',
@@ -154,6 +159,7 @@ _BANNED_CPP_FUNCTIONS = (
'id. Talk to robertshield@ for more information.',
),
True,
+ (),
),
(
'browser::FindOrCreateTabbedBrowser',
@@ -163,6 +169,7 @@ _BANNED_CPP_FUNCTIONS = (
'id. Talk to robertshield@ for more information.',
),
True,
+ (),
),
(
'browser::FindTabbedBrowserDeprecated',
@@ -172,6 +179,7 @@ _BANNED_CPP_FUNCTIONS = (
'id. Talk to robertshield@ for more information.',
),
True,
+ (),
),
(
'RunAllPending()',
@@ -180,6 +188,7 @@ _BANNED_CPP_FUNCTIONS = (
'to RunUntilIdle',
),
True,
+ (),
),
)
@@ -343,7 +352,15 @@ def _CheckNoBannedFunctions(input_api, output_api):
file_filter = lambda f: f.LocalPath().endswith(('.cc', '.mm', '.h'))
for f in input_api.AffectedFiles(file_filter=file_filter):
for line_num, line in f.ChangedContents():
- for func_name, message, error in _BANNED_CPP_FUNCTIONS:
+ for func_name, message, error, excluded_paths in _BANNED_CPP_FUNCTIONS:
+ def IsBlacklisted(affected_file, blacklist):
+ local_path = affected_file.LocalPath()
+ for item in blacklist:
+ if input_api.re.match(item, local_path):
+ return True
+ return False
+ if IsBlacklisted(f, excluded_paths):
+ continue
if func_name in line:
problems = warnings;
if error: