OLD | NEW |
---|---|
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 | |
12 | |
13 def CheckNoDcheck(input_api, output_api, white_list=None, black_list=None): | |
14 white_list = tuple(white_list or ('^cc/.*\.(cc|h)$',)) | |
enne (OOO)
2012/10/16 18:34:22
nit: r'^cc...
Also, what about just sticking thes
danakj
2012/10/16 19:11:51
Aded CC_SOURCE_FILES. The black_list has to stay t
| |
15 black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) | |
16 source_file_filter = lambda x: input_api.FilterSourceFile(x, white_list, black _list) | |
17 | |
18 bad_files = [] | |
19 for f in input_api.AffectedSourceFiles(source_file_filter): | |
20 contents = input_api.ReadFile(f, 'rb') | |
21 if re.search(r"(?<!CC_)DCHECK", contents): | |
22 bad_files.append(f.LocalPath()) | |
23 if bad_files: | |
24 return [output_api.PresubmitPromptWarning( | |
25 'These files use DCHECK instead of using CC_DCHECK:', | |
26 items=bad_files)] | |
27 return [] | |
28 | |
29 def CheckChangeOnUpload(input_api, output_api): | |
30 results = [] | |
31 results += CheckNoDcheck(input_api, output_api) | |
32 return results | |
33 | |
11 def GetPreferredTrySlaves(project, change): | 34 def GetPreferredTrySlaves(project, change): |
12 return [ | 35 return [ |
13 'linux_layout_rel', | 36 'linux_layout_rel', |
14 ] | 37 ] |
OLD | NEW |