Commit cf82459f authored by enne@chromium.org's avatar enne@chromium.org

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
parent e59558b7
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment