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

Unified Diff: PRESUBMIT.py

Issue 9826024: Added presubmit warning for ScopedAllowIO uses (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index b042b7c09a4099776c520c711f99d72ba64c0f89..87f089419eb057c1c858a64a54833db12eb5801a 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -183,6 +183,23 @@ def _CheckNoFRIEND_TEST(input_api, output_api):
'FRIEND_TEST_ALL_PREFIXES() instead.\n' + '\n'.join(problems))]
+def _CheckNoScopedAllowIO(input_api, output_api):
+ """Make sure that ScopedAllowIO is not used."""
+ problems = []
+
+ file_filter = lambda f: f.LocalPath().endswith(('.cc', '.h'))
+ for f in input_api.AffectedFiles(file_filter=file_filter):
+ for line_num, line in f.ChangedContents():
+ if 'ScopedAllowIO' in line:
+ problems.append(' %s:%d' % (f.LocalPath(), line_num))
+
+ if not problems:
+ return []
+ return [output_api.PresubmitPromptWarning('New code should not use '
+ 'ScopedAllowIO. Post a task to the blocking pool or the FILE thread '
+ 'instead.\n' + '\n'.join(problems))]
+
+
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
@@ -196,6 +213,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckNoNewWStrings(input_api, output_api))
results.extend(_CheckNoDEPSGIT(input_api, output_api))
results.extend(_CheckNoFRIEND_TEST(input_api, output_api))
+ results.extend(_CheckNoScopedAllowIO(input_api, output_api))
return results
« 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