diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 05:46:00 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-09 05:46:00 +0000 |
commit | cf82459ff616a494b882013ab16ab48fd14a70fe (patch) | |
tree | df28beffd0e54fbfd1a2ede31ce34588f39823df /cc/PRESUBMIT.py | |
parent | e59558b78e8c6a1b0bd916a724724b638c3c91b6 (diff) | |
download | chromium_src-cf82459ff616a494b882013ab16ab48fd14a70fe.zip chromium_src-cf82459ff616a494b882013ab16ab48fd14a70fe.tar.gz chromium_src-cf82459ff616a494b882013ab16ab48fd14a70fe.tar.bz2 |
cc: Turn on presubmit cpplint warnings
cc is nearly spotless with cpplint warnings, so let's keep it that way.
The CommonChecks lint warning turns off a ton of errors that I would
prefer to keep on. I turned it to level 1, since that's the default
when running cpplint.py.
This doesn't appear to be on by default.
R=jamesr@chromium.org
BUG=227196
Review URL: https://chromiumcodereview.appspot.com/13483022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/PRESUBMIT.py')
-rw-r--r-- | cc/PRESUBMIT.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py index 319d3b5..cf9737e 100644 --- a/cc/PRESUBMIT.py +++ b/cc/PRESUBMIT.py @@ -13,6 +13,24 @@ import re CC_SOURCE_FILES=(r'^cc/.*\.(cc|h)$',) CC_PERF_TEST =(r'^.*_perftest.*\.(cc|h)$',) +def CheckChangeLintsClean(input_api, output_api): + import cpplint + cpplint._cpplint_state.ResetErrorCounts() # reset global state + source_filter = lambda x: input_api.FilterSourceFile( + x, white_list=CC_SOURCE_FILES, black_list=None) + files = [f.AbsoluteLocalPath() for f in + input_api.AffectedSourceFiles(source_filter)] + level = 1 # strict, but just warn + + for file_name in files: + cpplint.ProcessFile(file_name, level) + + if not cpplint._cpplint_state.error_count: + return [] + + return [output_api.PresubmitPromptWarning( + 'Changelist failed cpplint.py check.')] + def CheckAsserts(input_api, output_api, white_list=CC_SOURCE_FILES, black_list=None): black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) source_file_filter = lambda x: input_api.FilterSourceFile(x, white_list, black_list) @@ -68,6 +86,7 @@ def CheckChangeOnUpload(input_api, output_api): results = [] results += CheckAsserts(input_api, output_api) results += CheckSpamLogging(input_api, output_api, black_list=CC_PERF_TEST) + results += CheckChangeLintsClean(input_api, output_api) return results def GetPreferredTrySlaves(project, change): |