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

Side by Side Diff: cc/PRESUBMIT.py

Issue 11778009: cc: Ban DLOG/LOG(INFO) from cc via presubmit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | no next file » | 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
(...skipping 20 matching lines...) Expand all
31 if assert_files: 31 if assert_files:
32 return [output_api.PresubmitError( 32 return [output_api.PresubmitError(
33 'These files use ASSERT instead of using DCHECK:', 33 'These files use ASSERT instead of using DCHECK:',
34 items=assert_files)] 34 items=assert_files)]
35 if notreached_files: 35 if notreached_files:
36 return [output_api.PresubmitError( 36 return [output_api.PresubmitError(
37 'These files use ASSERT_NOT_REACHED instead of using NOTREACHED:', 37 'These files use ASSERT_NOT_REACHED instead of using NOTREACHED:',
38 items=notreached_files)] 38 items=notreached_files)]
39 return [] 39 return []
40 40
41 def CheckSpamLogging(input_api, output_api, white_list=CC_SOURCE_FILES, black_li st=None):
42 black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST)
43 source_file_filter = lambda x: input_api.FilterSourceFile(x, white_list, black _list)
44
45 bad_files = []
46
47 for f in input_api.AffectedSourceFiles(source_file_filter):
48 contents = input_api.ReadFile(f, 'rb')
49 if re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", contents):
50 bad_files.append(f.LocalPath())
51
52 if bad_files:
53 return [output_api.PresubmitError(
54 'These files spam the console log with LOG(INFO):',
55 items=bad_files)]
56 return []
57
58
41 def CheckChangeOnUpload(input_api, output_api): 59 def CheckChangeOnUpload(input_api, output_api):
42 results = [] 60 results = []
43 results += CheckAsserts(input_api, output_api) 61 results += CheckAsserts(input_api, output_api)
62 results += CheckSpamLogging(input_api, output_api)
44 return results 63 return results
45 64
46 def GetPreferredTrySlaves(project, change): 65 def GetPreferredTrySlaves(project, change):
47 return [ 66 return [
48 'linux_layout_rel', 67 'linux_layout_rel',
49 ] 68 ]
OLDNEW
« 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