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

Unified Diff: tools/presubmit.py

Issue 837503003: Check author of a CL agaist the AUTHORS file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/presubmit.py
diff --git a/tools/presubmit.py b/tools/presubmit.py
index 321d2910d566fed889c40cffad0075b757a2e909..97b3b597d1eb6fc221c53e83ff72bac1df7bd3b0 100755
--- a/tools/presubmit.py
+++ b/tools/presubmit.py
@@ -438,6 +438,33 @@ def CheckExternalReferenceRegistration(workspace):
[sys.executable, join(workspace, "tools", "external-reference-check.py")])
return code == 0
+def CheckAuthorizedAuthor(input_api, output_api):
+ """For non-googler/chromites committers, verify the author's email address is
+ in AUTHORS.
+ """
+ # TODO(maruel): Add it to input_api?
+ import fnmatch
+
+ author = input_api.change.author_email
+ if not author:
+ input_api.logging.info('No author, skipping AUTHOR check')
+ return []
+ authors_path = input_api.os_path.join(
+ input_api.PresubmitLocalPath(), 'AUTHORS')
+ valid_authors = (
+ input_api.re.match(r'[^#]+\s+\<(.+?)\>\s*$', line)
+ for line in open(authors_path))
+ valid_authors = [item.group(1).lower() for item in valid_authors if item]
+ if not any(fnmatch.fnmatch(author.lower(), valid) for valid in valid_authors):
+ input_api.logging.info('Valid authors are %s', ', '.join(valid_authors))
+ return [output_api.PresubmitPromptWarning(
Michael Achenbach 2015/01/15 12:29:22 I assume a warning is enough to bail out?
marja 2015/01/15 12:37:39 It's a prompt warning, so it'll prompt the user an
+ ('%s is not in AUTHORS file. If you are a new contributor, please visit'
+ '\n'
+ 'http://www.chromium.org/developers/contributing-code and read the '
+ '"Legal" section\n'
+ 'If you are a chromite, verify the contributor signed the CLA.') %
+ author)]
+ return []
def GetOptions():
result = optparse.OptionParser()
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698