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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 owner = input_api.re.escape(issue_props['owner']) | 663 owner = input_api.re.escape(issue_props['owner']) |
664 | 664 |
665 # TODO(dpranke): This mimics the logic in | 665 # TODO(dpranke): This mimics the logic in |
666 # /tools/commit-queue/verifiers/reviewer_lgtm.py | 666 # /tools/commit-queue/verifiers/reviewer_lgtm.py |
667 # We should share the code and/or remove the check there where it is | 667 # We should share the code and/or remove the check there where it is |
668 # redundant (since the commit queue also enforces the presubmit checks). | 668 # redundant (since the commit queue also enforces the presubmit checks). |
669 def match_reviewer(r): | 669 def match_reviewer(r): |
670 return email_regexp.match(r) and not input_api.re.match(owner, r) | 670 return email_regexp.match(r) and not input_api.re.match(owner, r) |
671 | 671 |
672 approvers = [] | 672 approvers = [] |
673 for m in issue_props['messages']: | 673 for m in issue_props.get('messages', []): |
674 if 'lgtm' in m['text'].lower() and match_reviewer(m['sender']): | 674 if 'lgtm' in m['text'].lower() and match_reviewer(m['sender']): |
675 approvers.append(m['sender']) | 675 approvers.append(m['sender']) |
676 return set(approvers) | 676 return set(approvers) |
677 | 677 |
OLD | NEW |