remove redundant DCHECK that a size_t variable >= 0
[chromium-blink-merge.git] / base / PRESUBMIT.py
blobc84a99287bb80eb18e12f4eaefa8872f4d04cadc
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
3 # found in the LICENSE file.
5 """Chromium presubmit script for src/base.
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details on the presubmit API built into gcl.
9 """
11 def _CheckNoInterfacesInBase(input_api, output_api):
12 """Checks to make sure no files in libbase.a have |@interface|."""
13 pattern = input_api.re.compile(r'^\s*@interface', input_api.re.MULTILINE)
14 files = []
15 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
16 if (f.LocalPath().startswith('base/') and
17 not "/test/" in f.LocalPath() and
18 not f.LocalPath().endswith('_unittest.mm')):
19 contents = input_api.ReadFile(f)
20 if pattern.search(contents):
21 files.append(f)
23 if len(files):
24 return [ output_api.PresubmitError(
25 'Objective-C interfaces or categories are forbidden in libbase. ' +
26 'See http://groups.google.com/a/chromium.org/group/chromium-dev/' +
27 'browse_thread/thread/efb28c10435987fd',
28 files) ]
29 return []
32 def _CommonChecks(input_api, output_api):
33 """Checks common to both upload and commit."""
34 results = []
35 results.extend(_CheckNoInterfacesInBase(input_api, output_api))
36 return results
38 def CheckChangeOnUpload(input_api, output_api):
39 results = []
40 results.extend(_CommonChecks(input_api, output_api))
41 return results
44 def CheckChangeOnCommit(input_api, output_api):
45 results = []
46 results.extend(_CommonChecks(input_api, output_api))
47 return results
50 def GetPreferredTrySlaves():
51 return [
52 'linux_rel:sync_integration_tests',
53 'mac_rel:sync_integration_tests',
54 'win_rel:sync_integration_tests',