[test] reformat and rename presubmit checks

R=sergiyb@chromium.org

No-Try: true
Change-Id: I94937b6852c8e7e8aece3b67eb1c2a79dbf71c25
Reviewed-on: https://chromium-review.googlesource.com/c/1392193
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58671}
This commit is contained in:
Tamer Tas 2019-01-02 11:15:28 +01:00 committed by Commit Bot
parent 5e725a2b43
commit 9a529b122c
2 changed files with 10 additions and 8 deletions

View File

@ -74,7 +74,7 @@ def _V8PresubmitChecks(input_api, output_api):
sys.path.append(input_api.os_path.join(
input_api.PresubmitLocalPath(), 'tools'))
from v8_presubmit import CppLintProcessor
from v8_presubmit import TorqueFormatProcessor
from v8_presubmit import TorqueLintProcessor
from v8_presubmit import SourceProcessor
from v8_presubmit import StatusFilesProcessor
@ -93,7 +93,7 @@ def _V8PresubmitChecks(input_api, output_api):
if not CppLintProcessor().RunOnFiles(
input_api.AffectedFiles(file_filter=FilterFile, include_deletes=False)):
results.append(output_api.PresubmitError("C++ lint check failed"))
if not TorqueFormatProcessor().RunOnFiles(
if not TorqueLintProcessor().RunOnFiles(
input_api.AffectedFiles(file_filter=FilterTorqueFile,
include_deletes=False)):
results.append(output_api.PresubmitError("Torque format check failed"))

View File

@ -347,14 +347,15 @@ class CppLintProcessor(CacheableSourceFileProcessor):
return None, arguments
class TorqueFormatProcessor(CacheableSourceFileProcessor):
class TorqueLintProcessor(CacheableSourceFileProcessor):
"""
Check .tq files to verify they follow the Torque style guide.
"""
def __init__(self, use_cache=True):
super(TorqueFormatProcessor, self).__init__(
use_cache=use_cache, cache_file_path='.torquelint-cache', file_type='Torque')
super(TorqueLintProcessor, self).__init__(
use_cache=use_cache, cache_file_path='.torquelint-cache',
file_type='Torque')
def IsRelevant(self, name):
return name.endswith('.tq')
@ -663,8 +664,8 @@ def GetOptions():
result = optparse.OptionParser()
result.add_option('--no-lint', help="Do not run cpplint", default=False,
action="store_true")
result.add_option('--no-linter-cache', help="Do not cache linter results", default=False,
action="store_true")
result.add_option('--no-linter-cache', help="Do not cache linter results",
default=False, action="store_true")
return result
@ -682,7 +683,8 @@ def Main():
success &= CppLintProcessor(use_cache=use_linter_cache).RunOnPath(workspace)
print "Running Torque formatting check..."
success &= TorqueFormatProcessor(use_cache=use_linter_cache).RunOnPath(workspace)
success &= TorqueLintProcessor(use_cache=use_linter_cache).RunOnPath(
workspace)
print "Running copyright header, trailing whitespaces and " \
"two empty lines between declarations check..."
success &= SourceProcessor().RunOnPath(workspace)