OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 """ | 5 """ |
6 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 6 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
7 for more details on the presubmit API built into gcl. | 7 for more details on the presubmit API built into gcl. |
8 """ | 8 """ |
9 | 9 |
10 import re | 10 import re |
(...skipping 12 matching lines...) Expand all Loading... |
23 for f in filter(lambda x: sup_regex.search(x.LocalPath()), | 23 for f in filter(lambda x: sup_regex.search(x.LocalPath()), |
24 input_api.AffectedFiles()): | 24 input_api.AffectedFiles()): |
25 for line, line_num in zip(f.NewContents(), | 25 for line, line_num in zip(f.NewContents(), |
26 xrange(1, len(f.NewContents()) + 1)): | 26 xrange(1, len(f.NewContents()) + 1)): |
27 line = line.lstrip() | 27 line = line.lstrip() |
28 if line.startswith('#') or not line: | 28 if line.startswith('#') or not line: |
29 continue | 29 continue |
30 | 30 |
31 if skip_next_line: | 31 if skip_next_line: |
32 if skip_next_line == 'skip_suppression_name': | 32 if skip_next_line == 'skip_suppression_name': |
| 33 if 'insert_a_suppression_name_here' in line: |
| 34 errors.append('"insert_a_suppression_name_here" is not a valid ' |
| 35 'suppression name') |
33 if suppressions.has_key(line): | 36 if suppressions.has_key(line): |
34 if f.LocalPath() == suppressions[line][1]: | 37 if f.LocalPath() == suppressions[line][1]: |
35 errors.append('suppression with name "%s" at %s line %s ' | 38 errors.append('suppression with name "%s" at %s line %s ' |
36 'has already been defined at line %s' % | 39 'has already been defined at line %s' % |
37 (line, f.LocalPath(), line_num, | 40 (line, f.LocalPath(), line_num, |
38 suppressions[line][1])) | 41 suppressions[line][1])) |
39 else: | 42 else: |
40 errors.append('suppression with name "%s" at %s line %s ' | 43 errors.append('suppression with name "%s" at %s line %s ' |
41 'has already been defined at %s line %s' % | 44 'has already been defined at %s line %s' % |
42 (line, f.LocalPath(), line_num, | 45 (line, f.LocalPath(), line_num, |
(...skipping 26 matching lines...) Expand all Loading... |
69 return [] | 72 return [] |
70 | 73 |
71 def CheckChangeOnUpload(input_api, output_api): | 74 def CheckChangeOnUpload(input_api, output_api): |
72 return CheckChange(input_api, output_api) | 75 return CheckChange(input_api, output_api) |
73 | 76 |
74 def CheckChangeOnCommit(input_api, output_api): | 77 def CheckChangeOnCommit(input_api, output_api): |
75 return CheckChange(input_api, output_api) | 78 return CheckChange(input_api, output_api) |
76 | 79 |
77 def GetPreferredTrySlaves(): | 80 def GetPreferredTrySlaves(): |
78 return ['linux_valgrind', 'mac_valgrind'] | 81 return ['linux_valgrind', 'mac_valgrind'] |
OLD | NEW |