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

Side by Side Diff: PRESUBMIT.py

Issue 99653004: Catch printf() in CheckSpamLogging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 Chromium. 5 """Top-level presubmit script for Chromium.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
10 10
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 source_file_filter = lambda x: input_api.FilterSourceFile( 842 source_file_filter = lambda x: input_api.FilterSourceFile(
843 x, white_list=(file_inclusion_pattern,), black_list=black_list) 843 x, white_list=(file_inclusion_pattern,), black_list=black_list)
844 844
845 log_info = [] 845 log_info = []
846 printf = [] 846 printf = []
847 847
848 for f in input_api.AffectedSourceFiles(source_file_filter): 848 for f in input_api.AffectedSourceFiles(source_file_filter):
849 contents = input_api.ReadFile(f, 'rb') 849 contents = input_api.ReadFile(f, 'rb')
850 if re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", contents): 850 if re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", contents):
851 log_info.append(f.LocalPath()) 851 log_info.append(f.LocalPath())
852 if re.search(r"\bD?LOG_IF\s*\(\s*INFO\s*,", contents): 852 if re.search(r"\bD?LOG_IF\s*\(\s*INFO\s*,", contents):
M-A Ruel 2013/12/02 21:06:09 elif
jln (very slow on Chromium) 2013/12/02 21:38:06 Done.
853 log_info.append(f.LocalPath()) 853 log_info.append(f.LocalPath())
854 if re.search(r"\bf?printf\((stdout|stderr)", contents): 854 if re.search(r"\bprintf\(", contents):
M-A Ruel 2013/12/02 21:06:09 insert a line to make it clear they are not doing
jln (very slow on Chromium) 2013/12/02 21:38:06 Done.
855 printf.append(f.LocalPath())
856 if re.search(r"\bfprintf\((stdout|stderr)", contents):
M-A Ruel 2013/12/02 21:06:09 elif
jln (very slow on Chromium) 2013/12/02 21:38:06 Done.
855 printf.append(f.LocalPath()) 857 printf.append(f.LocalPath())
856 858
857 if log_info: 859 if log_info:
858 return [output_api.PresubmitError( 860 return [output_api.PresubmitError(
859 'These files spam the console log with LOG(INFO):', 861 'These files spam the console log with LOG(INFO):',
860 items=log_info)] 862 items=log_info)]
861 if printf: 863 if printf:
862 return [output_api.PresubmitError( 864 return [output_api.PresubmitError(
863 'These files spam the console log with printf/fprintf:', 865 'These files spam the console log with printf/fprintf:',
864 items=printf)] 866 items=printf)]
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 trybots += ['cros_x86'] 1137 trybots += ['cros_x86']
1136 1138
1137 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it 1139 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it
1138 # unless they're .gyp(i) files as changes to those files can break the gyp 1140 # unless they're .gyp(i) files as changes to those files can break the gyp
1139 # step on that bot. 1141 # step on that bot.
1140 if (not all(re.search('^chrome', f) for f in files) or 1142 if (not all(re.search('^chrome', f) for f in files) or
1141 any(re.search('\.gypi?$', f) for f in files)): 1143 any(re.search('\.gypi?$', f) for f in files)):
1142 trybots += ['android_aosp'] 1144 trybots += ['android_aosp']
1143 1145
1144 return trybots 1146 return trybots
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