summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-19 03:31:34 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-19 03:31:34 +0000
commit6a4c8e688fca92cecd35e112646162dfeb371b11 (patch)
tree942744faca6d15e16a588a5b0215a77de25ee3ca /PRESUBMIT.py
parent865ca92b7d169039fb4bb671ed54e7c0b6cd74ee (diff)
downloadchromium_src-6a4c8e688fca92cecd35e112646162dfeb371b11.zip
chromium_src-6a4c8e688fca92cecd35e112646162dfeb371b11.tar.gz
chromium_src-6a4c8e688fca92cecd35e112646162dfeb371b11.tar.bz2
Add a presubmit check that makes sure no interfaces or categories are in libbase.
BUG=46929 TEST=none Review URL: http://codereview.chromium.org/6017004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69672 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 311cb20..1f97a89 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -29,6 +29,25 @@ _LICENSE_HEADER = (
"\n"
)
+def _CheckNoInterfacesInBase(input_api, output_api, source_file_filter):
+ """Checks to make sure no files in libbase.a have |@interface|."""
+ pattern = input_api.re.compile(r'@interface')
+ files = []
+ for f in input_api.AffectedSourceFiles(source_file_filter):
+ if (f.LocalPath().find('base/') != -1 and
+ f.LocalPath().find('base/test/') == -1):
+ contents = input_api.ReadFile(f)
+ if pattern.search(contents):
+ files.append(f)
+
+ if len(files):
+ return [ output_api.PresubmitError(
+ 'Objective-C interfaces or categories are forbidden in libbase. ' +
+ 'See http://groups.google.com/a/chromium.org/group/chromium-dev/' +
+ 'browse_thread/thread/efb28c10435987fd',
+ files) ]
+ return []
+
def _CheckSingletonInHeaders(input_api, output_api, source_file_filter):
"""Checks to make sure no header files have |Singleton<|."""
pattern = input_api.re.compile(r'Singleton<')
@@ -101,6 +120,8 @@ def _CommonChecks(input_api, output_api):
input_api, output_api, source_file_filter=sources))
results.extend(_CheckSingletonInHeaders(
input_api, output_api, source_file_filter=sources))
+ results.extend(_CheckNoInterfacesInBase(
+ input_api, output_api, source_file_filter=sources))
return results