Reviewers: Michael Achenbach,
Message:
thanks for review
https://codereview.chromium.org/837503003/diff/1/tools/presubmit.py
File tools/presubmit.py (right):
https://codereview.chromium.org/837503003/diff/1/tools/presubmit.py#newcode460
tools/presubmit.py:460: return [output_api.PresubmitPromptWarning(
On 2015/01/15 12:29:22, Michael Achenbach wrote:
I assume a warning is enough to bail out?
It's a prompt warning, so it'll prompt the user and user has a chance to
[y/n]. The CQ will not answer that and will just bail out.
(Let's keep consistent w/ chromium regarding warning level & type.)
Description:
Check author of a CL against the AUTHORS file.
The code is copied from Chromium presubmit.
BUG=
Please review this at https://codereview.chromium.org/837503003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+29, -0 lines):
M PRESUBMIT.py
M tools/presubmit.py
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index
6d19a4e57408d711318a34fcf6b151d6fb66c526..2ab45ad7d29da1e91facc03f54b3fdb6834dd025
100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -69,6 +69,7 @@ def _V8PresubmitChecks(input_api, output_api):
from presubmit import SourceProcessor
from presubmit import CheckRuntimeVsNativesNameClashes
from presubmit import CheckExternalReferenceRegistration
+ from presubmit import CheckAuthorizedAuthor
results = []
if not CppLintProcessor().Run(input_api.PresubmitLocalPath()):
@@ -83,6 +84,7 @@ def _V8PresubmitChecks(input_api, output_api):
if not
CheckExternalReferenceRegistration(input_api.PresubmitLocalPath()):
results.append(output_api.PresubmitError(
"External references registration check failed"))
+ results.extend(CheckAuthorizedAuthor(input_api, output_api))
return results
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(
+ ('%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()
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.