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

Side by Side Diff: ui/PRESUBMIT.py

Issue 867163003: ui: Add PRESUBMIT script to check the usage of scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | 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
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
sky 2015/01/29 14:28:20 2015 and no copyright.
tfarina 2015/01/30 14:07:11 Done.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Presubmit script for ui.
6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools.
9 """
10
11 INCLUDE_CPP_FILES_ONLY = (
12 r'.*\.(cc|h)$',
sky 2015/01/29 14:28:20 What about .mm files?
tfarina 2015/01/30 14:07:11 Done.
13 )
14
15 def CheckScopedPtr(input_api, output_api,
16 white_list=INCLUDE_CPP_FILES_ONLY, black_list=None):
17 black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST)
18 source_file_filter = lambda x: input_api.FilterSourceFile(x,
19 white_list,
20 black_list)
21 errors = []
22 for f in input_api.AffectedSourceFiles(source_file_filter):
23 for line_number, line in f.ChangedContents():
24 # Disallow:
25 # scoped_ptr<T>()
26 if re.search(r'\bscoped_ptr<.*?>\(\)', line):
27 errors.append(output_api.PresubmitError(
28 '%s:%d uses scoped_ptr<T>(). Use nullptr instead.' %
29 (f.LocalPath(), line_number)))
30 return errors
31
32
33 def CheckChangeOnUpload(input_api, output_api):
34 results = []
35 results += CheckScopedPtr(input_api, output_api)
36 return results
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