Chromium Code Reviews| Index: cc/PRESUBMIT.py |
| diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py |
| index 060890112f93e9b8b250dbfb5ef3005104b15501..5e28c2800ab7ac184cac81be9878e7381d2f834a 100644 |
| --- a/cc/PRESUBMIT.py |
| +++ b/cc/PRESUBMIT.py |
| @@ -8,6 +8,29 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
| details on the presubmit API built into gcl. |
| """ |
| +import re |
| + |
| +def CheckNoDcheck(input_api, output_api, white_list=None, black_list=None): |
| + 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
|
| + black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) |
| + source_file_filter = lambda x: input_api.FilterSourceFile(x, white_list, black_list) |
| + |
| + bad_files = [] |
| + for f in input_api.AffectedSourceFiles(source_file_filter): |
| + contents = input_api.ReadFile(f, 'rb') |
| + if re.search(r"(?<!CC_)DCHECK", contents): |
| + bad_files.append(f.LocalPath()) |
| + if bad_files: |
| + return [output_api.PresubmitPromptWarning( |
| + 'These files use DCHECK instead of using CC_DCHECK:', |
| + items=bad_files)] |
| + return [] |
| + |
| +def CheckChangeOnUpload(input_api, output_api): |
| + results = [] |
| + results += CheckNoDcheck(input_api, output_api) |
| + return results |
| + |
| def GetPreferredTrySlaves(project, change): |
| return [ |
| 'linux_layout_rel', |