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

Side by Side Diff: cc/PRESUBMIT.py

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

Powered by Google App Engine
This is Rietveld 408576698