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

Side by Side Diff: cc/PRESUBMIT.py

Issue 13949005: Add cpplint for webkit/compositor_bindings (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/compositor_bindings/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Top-level presubmit script for cc. 5 """Top-level presubmit script for cc.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
8 details on the presubmit API built into gcl. 8 details on the presubmit API built into gcl.
9 """ 9 """
10 10
11 import re 11 import re
12 12
13 CC_SOURCE_FILES=(r'^cc/.*\.(cc|h)$',) 13 CC_SOURCE_FILES=(r'^cc/.*\.(cc|h)$',)
14 CC_PERF_TEST =(r'^.*_perftest.*\.(cc|h)$',) 14 CC_PERF_TEST =(r'^.*_perftest.*\.(cc|h)$',)
15 15
16 def CheckChangeLintsClean(input_api, output_api): 16 def CheckChangeLintsClean(input_api, output_api):
17 import cpplint 17 input_api.cpplint._cpplint_state.ResetErrorCounts() # reset global state
18 cpplint._cpplint_state.ResetErrorCounts() # reset global state
19 source_filter = lambda x: input_api.FilterSourceFile( 18 source_filter = lambda x: input_api.FilterSourceFile(
20 x, white_list=CC_SOURCE_FILES, black_list=None) 19 x, white_list=CC_SOURCE_FILES, black_list=None)
21 files = [f.AbsoluteLocalPath() for f in 20 files = [f.AbsoluteLocalPath() for f in
22 input_api.AffectedSourceFiles(source_filter)] 21 input_api.AffectedSourceFiles(source_filter)]
23 level = 1 # strict, but just warn 22 level = 1 # strict, but just warn
24 23
25 # Replace <hash_map> and <hash_set> as headers that need to be included 24 for file_name in files:
26 # with "base/hash_tables.h" instead. 25 input_api.cpplint.ProcessFile(file_name, level)
27 cpplint._re_pattern_templates = [
28 (a,b,'base/hash_tables.h') if (header == '<hash_map>' or
29 header == '<hash_set>')
30 else (a,b,header)
31 for (a,b,header) in cpplint._re_pattern_templates]
32 26
33 for file_name in files: 27 if not input_api.cpplint._cpplint_state.error_count:
34 cpplint.ProcessFile(file_name, level)
35
36 if not cpplint._cpplint_state.error_count:
37 return [] 28 return []
38 29
39 return [output_api.PresubmitPromptWarning( 30 return [output_api.PresubmitPromptWarning(
40 'Changelist failed cpplint.py check.')] 31 'Changelist failed cpplint.py check.')]
41 32
42 def CheckAsserts(input_api, output_api, white_list=CC_SOURCE_FILES, black_list=N one): 33 def CheckAsserts(input_api, output_api, white_list=CC_SOURCE_FILES, black_list=N one):
43 black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) 34 black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST)
44 source_file_filter = lambda x: input_api.FilterSourceFile(x, white_list, black _list) 35 source_file_filter = lambda x: input_api.FilterSourceFile(x, white_list, black _list)
45 36
46 assert_files = [] 37 assert_files = []
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 results = [] 85 results = []
95 results += CheckAsserts(input_api, output_api) 86 results += CheckAsserts(input_api, output_api)
96 results += CheckSpamLogging(input_api, output_api, black_list=CC_PERF_TEST) 87 results += CheckSpamLogging(input_api, output_api, black_list=CC_PERF_TEST)
97 results += CheckChangeLintsClean(input_api, output_api) 88 results += CheckChangeLintsClean(input_api, output_api)
98 return results 89 return results
99 90
100 def GetPreferredTrySlaves(project, change): 91 def GetPreferredTrySlaves(project, change):
101 return [ 92 return [
102 'linux_layout_rel', 93 'linux_layout_rel',
103 ] 94 ]
OLDNEW
« no previous file with comments | « no previous file | webkit/compositor_bindings/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698