OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
6 | 6 |
7 ### Description checks | 7 ### Description checks |
8 | 8 |
9 def CheckChangeHasTestField(input_api, output_api): | 9 def CheckChangeHasTestField(input_api, output_api): |
10 """Requires that the changelist have a TEST= field.""" | 10 """Requires that the changelist have a TEST= field.""" |
11 if input_api.change.TEST: | 11 if input_api.change.TEST: |
12 return [] | 12 return [] |
13 else: | 13 else: |
14 return [output_api.PresubmitNotifyResult( | 14 return [output_api.PresubmitNotifyResult( |
15 'Changelist should have a TEST= field. TEST=none is allowed.')] | 15 'If this change requires manual test instructions to QA team, add ' |
| 16 'TEST=[instructions].')] |
16 | 17 |
17 | 18 |
18 def CheckChangeHasBugField(input_api, output_api): | 19 def CheckChangeHasBugField(input_api, output_api): |
19 """Requires that the changelist have a BUG= field.""" | 20 """Requires that the changelist have a BUG= field.""" |
20 if input_api.change.BUG: | 21 if input_api.change.BUG: |
21 return [] | 22 return [] |
22 else: | 23 else: |
23 return [output_api.PresubmitNotifyResult( | 24 return [output_api.PresubmitNotifyResult( |
24 'Changelist should have a BUG= field. BUG=none is allowed.')] | 25 'If this change has an associated bug, add BUG=[bug number].')] |
25 | 26 |
26 | 27 |
27 def CheckChangeHasTestedField(input_api, output_api): | 28 def CheckChangeHasTestedField(input_api, output_api): |
28 """Requires that the changelist have a TESTED= field.""" | 29 """Requires that the changelist have a TESTED= field.""" |
29 if input_api.change.TESTED: | 30 if input_api.change.TESTED: |
30 return [] | 31 return [] |
31 else: | 32 else: |
32 return [output_api.PresubmitError('Changelist must have a TESTED= field.')] | 33 return [output_api.PresubmitError('Changelist must have a TESTED= field.')] |
33 | 34 |
34 | 35 |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 pending_builds_len = len(builder.get('pending_builds', [])) | 605 pending_builds_len = len(builder.get('pending_builds', [])) |
605 if pending_builds_len > max_pendings: | 606 if pending_builds_len > max_pendings: |
606 out.append('%s has %d build(s) pending' % | 607 out.append('%s has %d build(s) pending' % |
607 (builder_name, pending_builds_len)) | 608 (builder_name, pending_builds_len)) |
608 if out: | 609 if out: |
609 return [output_api.PresubmitPromptWarning( | 610 return [output_api.PresubmitPromptWarning( |
610 'Build(s) pending. It is suggested to wait that no more than %d ' | 611 'Build(s) pending. It is suggested to wait that no more than %d ' |
611 'builds are pending.' % max_pendings, | 612 'builds are pending.' % max_pendings, |
612 long_text='\n'.join(out))] | 613 long_text='\n'.join(out))] |
613 return [] | 614 return [] |
OLD | NEW |