[test] Refactoring - move presubmit method

Move a method that is not referenced in tools/presubmit.py.

BUG=v8:5603
NOTRY=true

Review-Url: https://codereview.chromium.org/2553623002
Cr-Commit-Position: refs/heads/master@{#41513}
This commit is contained in:
machenbach 2016-12-06 03:31:09 -08:00 committed by Commit bot
parent 4c7cccf9f4
commit d50108adc8
2 changed files with 2 additions and 30 deletions

View File

@ -67,7 +67,6 @@ def _V8PresubmitChecks(input_api, output_api):
input_api.PresubmitLocalPath(), 'tools'))
from presubmit import CppLintProcessor
from presubmit import SourceProcessor
from presubmit import CheckAuthorizedAuthor
from presubmit import CheckStatusFiles
results = []
@ -81,7 +80,8 @@ def _V8PresubmitChecks(input_api, output_api):
"between declarations check failed"))
if not CheckStatusFiles(input_api.PresubmitLocalPath()):
results.append(output_api.PresubmitError("Status file check failed"))
results.extend(CheckAuthorizedAuthor(input_api, output_api))
results.extend(input_api.canned_checks.CheckAuthorizedAuthor(
input_api, output_api))
return results

View File

@ -473,34 +473,6 @@ def CheckStatusFiles(workspace):
success &= _CheckStatusFileForDuplicateKeys(status_file_path)
return success
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()
result.add_option('--no-lint', help="Do not run cpplint", default=False,