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

Side by Side Diff: ui/PRESUBMIT.py

Issue 2311783002: Re-enable PRESUBMIT check for empty unique_ptr<> rvalue (Closed)
Patch Set: Remove obsolete TODO Created 4 years, 3 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 | ui/display/chromeos/display_configurator_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Presubmit script for ui. 5 """Presubmit script for ui.
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 15 matching lines...) Expand all
26 # bar = std::unique_ptr<T>(foo); 26 # bar = std::unique_ptr<T>(foo);
27 # But allow: 27 # But allow:
28 # return std::unique_ptr<T[]>(foo); 28 # return std::unique_ptr<T[]>(foo);
29 # bar = std::unique_ptr<T[]>(foo); 29 # bar = std::unique_ptr<T[]>(foo);
30 if input_api.re.search( 30 if input_api.re.search(
31 r'(=|\breturn)\s*std::unique_ptr<[^\[\]>]+>\([^)]+\)', line): 31 r'(=|\breturn)\s*std::unique_ptr<[^\[\]>]+>\([^)]+\)', line):
32 errors.append(output_api.PresubmitError( 32 errors.append(output_api.PresubmitError(
33 ('%s:%d uses explicit std::unique_ptr constructor. ' + 33 ('%s:%d uses explicit std::unique_ptr constructor. ' +
34 'Use base::MakeUnique<T>() or base::WrapUnique() instead.') % 34 'Use base::MakeUnique<T>() or base::WrapUnique() instead.') %
35 (f.LocalPath(), line_number))) 35 (f.LocalPath(), line_number)))
36 # TODO(sky): this incorrectly catches templates. Fix and reenable.
37 # Disallow: 36 # Disallow:
38 # std::unique_ptr<T>() 37 # std::unique_ptr<T>()
39 # if input_api.re.search(r'\bstd::unique_ptr<.*?>\(\)', line): 38 if input_api.re.search(r'\bstd::unique_ptr<[^<>]+>\(\)', line):
40 # errors.append(output_api.PresubmitError( 39 errors.append(output_api.PresubmitError(
41 # '%s:%d uses std::unique_ptr<T>(). Use nullptr instead.' % 40 '%s:%d uses std::unique_ptr<T>(). Use nullptr instead.' %
42 # (f.LocalPath(), line_number))) 41 (f.LocalPath(), line_number)))
43 return errors 42 return errors
44 43
45 44
46 def CheckChange(input_api, output_api): 45 def CheckChange(input_api, output_api):
47 results = [] 46 results = []
48 results += CheckUniquePtr(input_api, output_api) 47 results += CheckUniquePtr(input_api, output_api)
49 return results 48 return results
50 49
51 50
52 def CheckChangeOnUpload(input_api, output_api): 51 def CheckChangeOnUpload(input_api, output_api):
53 return CheckChange(input_api, output_api) 52 return CheckChange(input_api, output_api)
54 53
55 54
56 def CheckChangeOnCommit(input_api, output_api): 55 def CheckChangeOnCommit(input_api, output_api):
57 return CheckChange(input_api, output_api) 56 return CheckChange(input_api, output_api)
OLDNEW
« no previous file with comments | « no previous file | ui/display/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698