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.""" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return [] | 74 return [] |
75 | 75 |
76 | 76 |
77 def CheckChangeLintsClean(input_api, output_api, source_file_filter=None): | 77 def CheckChangeLintsClean(input_api, output_api, source_file_filter=None): |
78 """Checks that all '.cc' and '.h' files pass cpplint.py.""" | 78 """Checks that all '.cc' and '.h' files pass cpplint.py.""" |
79 _RE_IS_TEST = input_api.re.compile(r'.*tests?.(cc|h)$') | 79 _RE_IS_TEST = input_api.re.compile(r'.*tests?.(cc|h)$') |
80 result = [] | 80 result = [] |
81 | 81 |
82 # Initialize cpplint. | 82 # Initialize cpplint. |
83 import cpplint | 83 import cpplint |
| 84 # Access to a protected member _XX of a client class |
| 85 # pylint: disable=W0212 |
84 cpplint._cpplint_state.ResetErrorCounts() | 86 cpplint._cpplint_state.ResetErrorCounts() |
85 | 87 |
86 # Justifications for each filter: | 88 # Justifications for each filter: |
87 # | 89 # |
88 # - build/include : Too many; fix in the future. | 90 # - build/include : Too many; fix in the future. |
89 # - build/include_order : Not happening; #ifdefed includes. | 91 # - build/include_order : Not happening; #ifdefed includes. |
90 # - build/namespace : I'm surprised by how often we violate this rule. | 92 # - build/namespace : I'm surprised by how often we violate this rule. |
91 # - readability/casting : Mistakes a whole bunch of function pointer. | 93 # - readability/casting : Mistakes a whole bunch of function pointer. |
92 # - runtime/int : Can be fixed long term; volume of errors too high | 94 # - runtime/int : Can be fixed long term; volume of errors too high |
93 # - runtime/virtual : Broken now, but can be fixed in the future? | 95 # - runtime/virtual : Broken now, but can be fixed in the future? |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 pending_builds_len = len(builder.get('pending_builds', [])) | 526 pending_builds_len = len(builder.get('pending_builds', [])) |
525 if pending_builds_len > max_pendings: | 527 if pending_builds_len > max_pendings: |
526 out.append('%s has %d build(s) pending' % | 528 out.append('%s has %d build(s) pending' % |
527 (builder_name, pending_builds_len)) | 529 (builder_name, pending_builds_len)) |
528 if out: | 530 if out: |
529 return [output_api.PresubmitPromptWarning( | 531 return [output_api.PresubmitPromptWarning( |
530 'Build(s) pending. It is suggested to wait that no more than %d ' | 532 'Build(s) pending. It is suggested to wait that no more than %d ' |
531 'builds are pending.' % max_pendings, | 533 'builds are pending.' % max_pendings, |
532 long_text='\n'.join(out))] | 534 long_text='\n'.join(out))] |
533 return [] | 535 return [] |
OLD | NEW |