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

Unified Diff: cc/PRESUBMIT.py

Issue 13483022: cc: Turn on presubmit cpplint warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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: cc/PRESUBMIT.py
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py
index 319d3b5234469fda2acd4114ac8b5bc7905f9913..cf9737e59f158512e58aad36de62c841bb461515 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):
« 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