OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if re.search(r'(=|\breturn)\s*scoped_ptr<.*?(?<!])>\([^)]+\)', line): | 184 if re.search(r'(=|\breturn)\s*scoped_ptr<.*?(?<!])>\([^)]+\)', line): |
185 errors.append(output_api.PresubmitError( | 185 errors.append(output_api.PresubmitError( |
186 ('%s:%d uses explicit scoped_ptr constructor. ' + | 186 ('%s:%d uses explicit scoped_ptr constructor. ' + |
187 'Use make_scoped_ptr() instead.') % (f.LocalPath(), line_number))) | 187 'Use make_scoped_ptr() instead.') % (f.LocalPath(), line_number))) |
188 # Disallow: | 188 # Disallow: |
189 # scoped_ptr<T>() | 189 # scoped_ptr<T>() |
190 if re.search(r'\bscoped_ptr<.*?>\(\)', line): | 190 if re.search(r'\bscoped_ptr<.*?>\(\)', line): |
191 errors.append(output_api.PresubmitError( | 191 errors.append(output_api.PresubmitError( |
192 '%s:%d uses scoped_ptr<T>(). Use nullptr instead.' % | 192 '%s:%d uses scoped_ptr<T>(). Use nullptr instead.' % |
193 (f.LocalPath(), line_number))) | 193 (f.LocalPath(), line_number))) |
194 # Disallow: | |
195 # foo.PassAs<T>(); | |
196 if re.search(r'\bPassAs<.*?>\(\)', line): | |
197 errors.append(output_api.PresubmitError( | |
198 '%s:%d uses PassAs<T>(). Use Pass() instead.' % | |
199 (f.LocalPath(), line_number))) | |
200 return errors | 194 return errors |
201 | 195 |
202 def FindUnquotedQuote(contents, pos): | 196 def FindUnquotedQuote(contents, pos): |
203 match = re.search(r"(?<!\\)(?P<quote>\")", contents[pos:]) | 197 match = re.search(r"(?<!\\)(?P<quote>\")", contents[pos:]) |
204 return -1 if not match else match.start("quote") + pos | 198 return -1 if not match else match.start("quote") + pos |
205 | 199 |
206 def FindUselessIfdefs(input_api, output_api): | 200 def FindUselessIfdefs(input_api, output_api): |
207 errors = [] | 201 errors = [] |
208 source_file_filter = lambda x: x | 202 source_file_filter = lambda x: x |
209 for f in input_api.AffectedSourceFiles(source_file_filter): | 203 for f in input_api.AffectedSourceFiles(source_file_filter): |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 results += CheckOverrideFinal(input_api, output_api) | 377 results += CheckOverrideFinal(input_api, output_api) |
384 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) | 378 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) |
385 return results | 379 return results |
386 | 380 |
387 def GetPreferredTryMasters(project, change): | 381 def GetPreferredTryMasters(project, change): |
388 return { | 382 return { |
389 'tryserver.blink': { | 383 'tryserver.blink': { |
390 'linux_blink_rel': set(['defaulttests']), | 384 'linux_blink_rel': set(['defaulttests']), |
391 }, | 385 }, |
392 } | 386 } |
OLD | NEW |