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

Side by Side Diff: cc/PRESUBMIT.py

Issue 628443002: replace OVERRIDE and FINAL with override and final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
« no previous file with comments | « no previous file | cc/animation/animation_curve.h » ('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 cc. 5 """Top-level presubmit script for cc.
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 depot_tools. 8 for more details about the presubmit API built into depot_tools.
9 """ 9 """
10 10
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 if problems: 307 if problems:
308 return [output_api.PresubmitPromptOrNotify( 308 return [output_api.PresubmitPromptOrNotify(
309 'You added one or more references to the base::Time class and/or one\n' 309 'You added one or more references to the base::Time class and/or one\n'
310 'of its member functions (or base::Clock/DefaultClock). In cc code,\n' 310 'of its member functions (or base::Clock/DefaultClock). In cc code,\n'
311 'it is most certainly incorrect! Instead use base::TimeTicks.\n\n' 311 'it is most certainly incorrect! Instead use base::TimeTicks.\n\n'
312 '\n'.join(problems))] 312 '\n'.join(problems))]
313 else: 313 else:
314 return [] 314 return []
315 315
316 def CheckOverrideFinal(input_api, output_api,
317 whitelist=CC_SOURCE_FILES, blacklist=None):
318 """Make sure new lines of code don't use the OVERRIDE or FINAL macros."""
319
320 # TODO(mostynb): remove this check once the macros are removed
321 # from base/compiler_specific.h.
322
323 errors = []
324
325 source_file_filter = lambda x: input_api.FilterSourceFile(
326 x, white_list=CC_SOURCE_FILES, black_list=None)
327
328 override_files = []
329 final_files = []
330
331 for f in input_api.AffectedSourceFiles(source_file_filter):
332 contents = input_api.ReadFile(f, 'rb')
333
334 # "override" and "final" should be used instead of OVERRIDE/FINAL now.
335 if re.search(r"\bOVERRIDE\b", contents):
336 override_files.append(f.LocalPath())
337
338 if re.search(r"\bFINAL\b", contents):
339 final_files.append(f.LocalPath())
340
341 if override_files:
342 return [output_api.PresubmitError(
343 'These files use OVERRIDE instead of using override:',
344 items=override_files)]
345 if final_files:
346 return [output_api.PresubmitError(
347 'These files use FINAL instead of using final:',
348 items=final_files)]
349
350 return []
351
316 def CheckChangeOnUpload(input_api, output_api): 352 def CheckChangeOnUpload(input_api, output_api):
317 results = [] 353 results = []
318 results += CheckAsserts(input_api, output_api) 354 results += CheckAsserts(input_api, output_api)
319 results += CheckStdAbs(input_api, output_api) 355 results += CheckStdAbs(input_api, output_api)
320 results += CheckPassByValue(input_api, output_api) 356 results += CheckPassByValue(input_api, output_api)
321 results += CheckChangeLintsClean(input_api, output_api) 357 results += CheckChangeLintsClean(input_api, output_api)
322 results += CheckTodos(input_api, output_api) 358 results += CheckTodos(input_api, output_api)
323 results += CheckScopedPtr(input_api, output_api) 359 results += CheckScopedPtr(input_api, output_api)
324 results += CheckNamespace(input_api, output_api) 360 results += CheckNamespace(input_api, output_api)
325 results += CheckForUseOfWrongClock(input_api, output_api) 361 results += CheckForUseOfWrongClock(input_api, output_api)
326 results += FindUselessIfdefs(input_api, output_api) 362 results += FindUselessIfdefs(input_api, output_api)
363 results += CheckOverrideFinal(input_api, output_api)
327 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) 364 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
328 return results 365 return results
329 366
330 def GetPreferredTryMasters(project, change): 367 def GetPreferredTryMasters(project, change):
331 return { 368 return {
332 'tryserver.blink': { 369 'tryserver.blink': {
333 'linux_blink_rel': set(['defaulttests']), 370 'linux_blink_rel': set(['defaulttests']),
334 }, 371 },
335 'tryserver.chromium.gpu': { 372 'tryserver.chromium.gpu': {
336 'linux_gpu': set(['defaulttests']), 373 'linux_gpu': set(['defaulttests']),
337 'mac_gpu': set(['defaulttests']), 374 'mac_gpu': set(['defaulttests']),
338 'win_gpu': set(['defaulttests']), 375 'win_gpu': set(['defaulttests']),
339 }, 376 },
340 } 377 }
OLDNEW
« no previous file with comments | « no previous file | cc/animation/animation_curve.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698