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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 if ('FIX'+'ME') in contents: | 143 if ('FIX'+'ME') in contents: |
144 errors.append(f.LocalPath()) | 144 errors.append(f.LocalPath()) |
145 | 145 |
146 if errors: | 146 if errors: |
147 return [output_api.PresubmitError( | 147 return [output_api.PresubmitError( |
148 'All TODO comments should be of the form TODO(name). ' + | 148 'All TODO comments should be of the form TODO(name). ' + |
149 'Use TODO instead of FIX' + 'ME', | 149 'Use TODO instead of FIX' + 'ME', |
150 items=errors)] | 150 items=errors)] |
151 return [] | 151 return [] |
152 | 152 |
| 153 def CheckDoubleAngles(input_api, output_api, white_list=CC_SOURCE_FILES, |
| 154 black_list=None): |
| 155 errors = [] |
| 156 |
| 157 source_file_filter = lambda x: input_api.FilterSourceFile(x, |
| 158 white_list, |
| 159 black_list) |
| 160 for f in input_api.AffectedSourceFiles(source_file_filter): |
| 161 contents = input_api.ReadFile(f, 'rb') |
| 162 if ('> >') in contents: |
| 163 errors.append(f.LocalPath()) |
| 164 |
| 165 if errors: |
| 166 return [output_api.PresubmitError('Use >> instead of > >:', items=errors)] |
| 167 return [] |
| 168 |
153 def CheckScopedPtr(input_api, output_api, | 169 def CheckScopedPtr(input_api, output_api, |
154 white_list=CC_SOURCE_FILES, black_list=None): | 170 white_list=CC_SOURCE_FILES, black_list=None): |
155 black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) | 171 black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) |
156 source_file_filter = lambda x: input_api.FilterSourceFile(x, | 172 source_file_filter = lambda x: input_api.FilterSourceFile(x, |
157 white_list, | 173 white_list, |
158 black_list) | 174 black_list) |
159 errors = [] | 175 errors = [] |
160 for f in input_api.AffectedSourceFiles(source_file_filter): | 176 for f in input_api.AffectedSourceFiles(source_file_filter): |
161 for line_number, line in f.ChangedContents(): | 177 for line_number, line in f.ChangedContents(): |
162 # Disallow: | 178 # Disallow: |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 368 |
353 return [] | 369 return [] |
354 | 370 |
355 def CheckChangeOnUpload(input_api, output_api): | 371 def CheckChangeOnUpload(input_api, output_api): |
356 results = [] | 372 results = [] |
357 results += CheckAsserts(input_api, output_api) | 373 results += CheckAsserts(input_api, output_api) |
358 results += CheckStdAbs(input_api, output_api) | 374 results += CheckStdAbs(input_api, output_api) |
359 results += CheckPassByValue(input_api, output_api) | 375 results += CheckPassByValue(input_api, output_api) |
360 results += CheckChangeLintsClean(input_api, output_api) | 376 results += CheckChangeLintsClean(input_api, output_api) |
361 results += CheckTodos(input_api, output_api) | 377 results += CheckTodos(input_api, output_api) |
| 378 results += CheckDoubleAngles(input_api, output_api) |
362 results += CheckScopedPtr(input_api, output_api) | 379 results += CheckScopedPtr(input_api, output_api) |
363 results += CheckNamespace(input_api, output_api) | 380 results += CheckNamespace(input_api, output_api) |
364 results += CheckForUseOfWrongClock(input_api, output_api) | 381 results += CheckForUseOfWrongClock(input_api, output_api) |
365 results += FindUselessIfdefs(input_api, output_api) | 382 results += FindUselessIfdefs(input_api, output_api) |
366 results += CheckOverrideFinal(input_api, output_api) | 383 results += CheckOverrideFinal(input_api, output_api) |
367 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) | 384 results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) |
368 return results | 385 return results |
369 | 386 |
370 def GetPreferredTryMasters(project, change): | 387 def GetPreferredTryMasters(project, change): |
371 return { | 388 return { |
372 'tryserver.blink': { | 389 'tryserver.blink': { |
373 'linux_blink_rel': set(['defaulttests']), | 390 'linux_blink_rel': set(['defaulttests']), |
374 }, | 391 }, |
375 'tryserver.chromium.gpu': { | 392 'tryserver.chromium.gpu': { |
376 'linux_gpu': set(['defaulttests']), | 393 'linux_gpu': set(['defaulttests']), |
377 'mac_gpu': set(['defaulttests']), | 394 'mac_gpu': set(['defaulttests']), |
378 'win_gpu': set(['defaulttests']), | 395 'win_gpu': set(['defaulttests']), |
379 }, | 396 }, |
380 } | 397 } |
OLD | NEW |