diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 21:49:22 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 21:49:22 +0000 |
commit | 8ea5d4bd1f750572bec6b6b73732bba147f0be42 (patch) | |
tree | be32a79a68dbd261a25eb06878c1355644ff1422 /PRESUBMIT.py | |
parent | c13b1e74736c5c65500abf4dfff5ad19ec4383e4 (diff) | |
download | chromium_src-8ea5d4bd1f750572bec6b6b73732bba147f0be42.zip chromium_src-8ea5d4bd1f750572bec6b6b73732bba147f0be42.tar.gz chromium_src-8ea5d4bd1f750572bec6b6b73732bba147f0be42.tar.bz2 |
PRESUBMIT: reject changes that add wstrings
We are trying to get rid of wstrings, but new code keeps getting
checked in that adds more. This will help prevent future mistakes.
Review URL: http://codereview.chromium.org/7886019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100974 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r-- | PRESUBMIT.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 8340b30..888e69a 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -111,6 +111,23 @@ def _CheckNoIOStreamInHeaders(input_api, output_api): return [] +def _CheckNoNewWStrings(input_api, output_api): + """Checks to make sure we don't introduce use of wstrings.""" + errors = [] + for f in input_api.AffectedFiles(): + for line_num, line in f.ChangedContents(): + if not f.LocalPath().endswith(('.cc', '.h')): + continue + + if 'wstring' in line: + errors.append(output_api.PresubmitError( + '%s, line %d: new code should not use wstrings. If you are ' + 'calling an API that accepts a wstring, fix the API.' + % (f.LocalPath(), line_num))) + + return errors + + def _CommonChecks(input_api, output_api): """Checks common to both upload and commit.""" results = [] @@ -121,6 +138,7 @@ def _CommonChecks(input_api, output_api): results.extend( _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) + results.extend(_CheckNoNewWStrings(input_api, output_api)) return results |