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

Side by Side Diff: PRESUBMIT.py

Issue 93903011: Remove 'using base::string16;' from base/strings/string16.h and remove temporary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asdf Created 6 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 | PRESUBMIT_test.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 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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api)) 1030 results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api))
1031 results.extend( 1031 results.extend(
1032 input_api.canned_checks.CheckChangeHasNoTabs( 1032 input_api.canned_checks.CheckChangeHasNoTabs(
1033 input_api, 1033 input_api,
1034 output_api, 1034 output_api,
1035 source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) 1035 source_file_filter=lambda x: x.LocalPath().endswith('.grd')))
1036 results.extend(_CheckSpamLogging(input_api, output_api)) 1036 results.extend(_CheckSpamLogging(input_api, output_api))
1037 results.extend(_CheckForAnonymousVariables(input_api, output_api)) 1037 results.extend(_CheckForAnonymousVariables(input_api, output_api))
1038 results.extend(_CheckCygwinShell(input_api, output_api)) 1038 results.extend(_CheckCygwinShell(input_api, output_api))
1039 results.extend(_CheckJavaStyle(input_api, output_api)) 1039 results.extend(_CheckJavaStyle(input_api, output_api))
1040 results.extend(_CheckForString16(input_api, output_api))
1041 1040
1042 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): 1041 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
1043 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( 1042 results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
1044 input_api, output_api, 1043 input_api, output_api,
1045 input_api.PresubmitLocalPath(), 1044 input_api.PresubmitLocalPath(),
1046 whitelist=[r'^PRESUBMIT_test\.py$'])) 1045 whitelist=[r'^PRESUBMIT_test\.py$']))
1047 return results 1046 return results
1048 1047
1049 1048
1050 def _CheckSubversionConfig(input_api, output_api): 1049 def _CheckSubversionConfig(input_api, output_api):
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 bad_macros.extend(_CheckForInvalidOSMacrosInFile(input_api, f)) 1172 bad_macros.extend(_CheckForInvalidOSMacrosInFile(input_api, f))
1174 1173
1175 if not bad_macros: 1174 if not bad_macros:
1176 return [] 1175 return []
1177 1176
1178 return [output_api.PresubmitError( 1177 return [output_api.PresubmitError(
1179 'Possibly invalid OS macro[s] found. Please fix your code\n' 1178 'Possibly invalid OS macro[s] found. Please fix your code\n'
1180 'or add your macro to src/PRESUBMIT.py.', bad_macros)] 1179 'or add your macro to src/PRESUBMIT.py.', bad_macros)]
1181 1180
1182 1181
1183 def _CheckForString16InFile(input_api, f):
1184 """Check for string16 without base:: in front."""
1185 reg = input_api.re.compile(r'\b(?<!base::)string16\b')
1186 use = 'using base::string16;'
1187 include = '#include "base/strings/string16.h"'
1188 results = []
1189 for lnum, line in f.ChangedContents():
1190 if reg.search(line) and not include in line and not use in f.NewContents():
1191 results.append(' %s:%d' % (f.LocalPath(), lnum))
1192 return results
1193
1194
1195 def _CheckForString16(input_api, output_api):
1196 file_filter = lambda f: input_api.FilterSourceFile(f,
1197 white_list=(
1198 r'^android_webview[\\\/]',
1199 r'^apps[\\\/]',
1200 r'^ash[\\\/]',
1201 r'^chrome[\\\/]',
1202 r'^chrome_frame[\\\/]',
1203 r'^chromeos[\\\/]',
1204 r'^components[\\\/]',
1205 r'^content[\\\/]',
1206 r'^device[\\\/]',
1207 r'^ipc[\\\/]',
1208 r'^net[\\\/]',
1209 r'^ppapi[\\\/]',
1210 r'^printing[\\\/]',
1211 r'^rlz[\\\/]',
1212 r'^skia[\\\/]',
1213 r'^tools[\\\/]',
1214 r'^ui[\\\/]',
1215 r'^webkit[\\\/]',
1216 r'^win8[\\\/]',
1217 ),
1218 black_list=(_EXCLUDED_PATHS + _TEST_CODE_EXCLUDED_PATHS +
1219 input_api.DEFAULT_BLACK_LIST))
1220
1221 unprefixed = []
1222 for f in input_api.AffectedFiles(file_filter=file_filter):
1223 unprefixed.extend(_CheckForString16InFile(input_api, f))
1224
1225 if not unprefixed:
1226 return []
1227
1228 return [output_api.PresubmitPromptWarning(
1229 'string16 should be prefixed with base:: namespace.', unprefixed)]
1230
1231
1232 def CheckChangeOnUpload(input_api, output_api): 1182 def CheckChangeOnUpload(input_api, output_api):
1233 results = [] 1183 results = []
1234 results.extend(_CommonChecks(input_api, output_api)) 1184 results.extend(_CommonChecks(input_api, output_api))
1235 return results 1185 return results
1236 1186
1237 1187
1238 def GetDefaultTryConfigs(bots=None): 1188 def GetDefaultTryConfigs(bots=None):
1239 """Returns a list of ('bot', set(['tests']), optionally filtered by [bots]. 1189 """Returns a list of ('bot', set(['tests']), optionally filtered by [bots].
1240 1190
1241 To add tests to this list, they MUST be in the the corresponding master's 1191 To add tests to this list, they MUST be in the the corresponding master's
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 trybots.extend(GetDefaultTryConfigs(['cros_x86'])) 1428 trybots.extend(GetDefaultTryConfigs(['cros_x86']))
1479 1429
1480 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it 1430 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it
1481 # unless they're .gyp(i) files as changes to those files can break the gyp 1431 # unless they're .gyp(i) files as changes to those files can break the gyp
1482 # step on that bot. 1432 # step on that bot.
1483 if (not all(re.search('^chrome', f) for f in files) or 1433 if (not all(re.search('^chrome', f) for f in files) or
1484 any(re.search('\.gypi?$', f) for f in files)): 1434 any(re.search('\.gypi?$', f) for f in files)):
1485 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) 1435 trybots.extend(GetDefaultTryConfigs(['android_aosp']))
1486 1436
1487 return trybots 1437 return trybots
OLDNEW
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698