Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Side by Side Diff: presubmit_canned_checks.py

Issue 215153004: For determining OWNERS, drop reviewers specified via '-r' that aren't in email address format. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Drop non-email addresses instead Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 import os as _os 7 import os as _os
8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) 8 _HERE = _os.path.dirname(_os.path.abspath(__file__))
9 9
10 10
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 issue=int(issue), messages=messages) 852 issue=int(issue), messages=messages)
853 853
854 854
855 def _ReviewersFromChange(change): 855 def _ReviewersFromChange(change):
856 """Return the reviewers specified in the |change|, if any.""" 856 """Return the reviewers specified in the |change|, if any."""
857 reviewers = set() 857 reviewers = set()
858 if change.R: 858 if change.R:
859 reviewers.update(set([r.strip() for r in change.R.split(',')])) 859 reviewers.update(set([r.strip() for r in change.R.split(',')]))
860 if change.TBR: 860 if change.TBR:
861 reviewers.update(set([r.strip() for r in change.TBR.split(',')])) 861 reviewers.update(set([r.strip() for r in change.TBR.split(',')]))
862 return reviewers 862
863 # Drop reviewers that aren't specified in email address format.
864 return set(reviewer for reviewer in reviewers if '@' in reviewer)
863 865
864 866
865 def _RietveldOwnerAndReviewers(input_api, email_regexp, approval_needed=False): 867 def _RietveldOwnerAndReviewers(input_api, email_regexp, approval_needed=False):
866 """Return the owner and reviewers of a change, if any. 868 """Return the owner and reviewers of a change, if any.
867 869
868 If approval_needed is True, only reviewers who have approved the change 870 If approval_needed is True, only reviewers who have approved the change
869 will be returned. 871 will be returned.
870 """ 872 """
871 issue_props = _GetRietveldIssueProps(input_api, True) 873 issue_props = _GetRietveldIssueProps(input_api, True)
872 if not issue_props: 874 if not issue_props:
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 def CheckPatchFormatted(input_api, output_api): 1061 def CheckPatchFormatted(input_api, output_api):
1060 import git_cl 1062 import git_cl
1061 cmd = ['cl', 'format', '--dry-run', input_api.PresubmitLocalPath()] 1063 cmd = ['cl', 'format', '--dry-run', input_api.PresubmitLocalPath()]
1062 code, _ = git_cl.RunGitWithCode(cmd, suppress_stderr=True) 1064 code, _ = git_cl.RunGitWithCode(cmd, suppress_stderr=True)
1063 if code == 2: 1065 if code == 2:
1064 return [output_api.PresubmitPromptWarning( 1066 return [output_api.PresubmitPromptWarning(
1065 'Your patch is not formatted, please run git cl format.')] 1067 'Your patch is not formatted, please run git cl format.')]
1066 # As this is just a warning, ignore all other errors if the user 1068 # As this is just a warning, ignore all other errors if the user
1067 # happens to have a broken clang-format, doesn't use git, etc etc. 1069 # happens to have a broken clang-format, doesn't use git, etc etc.
1068 return [] 1070 return []
OLDNEW
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698