Commit 660771b1 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

check-webkit-style: Remove obsolete code.

- Jinja template files have .tmpl extension now.

- Remove should_skip_with_warning()
  We have no files match to _SKIPPED_FILES_WITH_WARNING.

- Remove non-existent files from _SKIPPED_FILES_WITHOUT_WARNING.

Change-Id: I5e7e11bc806cd4da3ad46aa1981e34ae5286c944
Reviewed-on: https://chromium-review.googlesource.com/974722Reviewed-by: default avatarQuinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544986}
parent cd18e02e
......@@ -125,12 +125,6 @@ _PATH_RULES_SPECIFIER = [
'+pep8/W291', # Trailing white space
'+whitespace/carriage_return']),
([ # Jinja templates: files have .cpp or .h extensions, but contain
# template code, which can't be handled, so disable tests.
'Source/bindings/templates',
'Source/build/scripts/templates'],
['-']),
([ # IDL compiler reference output
# Conforming to style significantly increases the complexity of the code
# generator and decreases *its* readability, which is of more concern
......@@ -187,30 +181,12 @@ _XML_FILE_EXTENSIONS = [
_PNG_FILE_EXTENSION = 'png'
# Files to skip that are less obvious.
#
# Some files should be skipped when checking style. For example,
# WebKit maintains some files in Mozilla style on purpose to ease
# future merges.
_SKIPPED_FILES_WITH_WARNING = [
'Source/WebKit/gtk/tests/',
# All WebKit*.h files in Source/WebKit2/UIProcess/API/gtk,
# except those ending in ...Private.h are GTK+ API headers,
# which differ greatly from WebKit coding style.
re.compile(r'Source/WebKit2/UIProcess/API/gtk/WebKit(?!.*Private\.h).*\.h$'),
re.compile(r'Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKit(?!.*Private\.h).*\.h$'),
'Source/WebKit2/UIProcess/API/gtk/webkit2.h',
'Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h']
# Files to skip that are more common or obvious.
#
# This list should be in addition to files with FileType.NONE. Files
# with FileType.NONE are automatically skipped without warning.
_SKIPPED_FILES_WITHOUT_WARNING = [
'LayoutTests' + os.path.sep,
'Source/ThirdParty/leveldb' + os.path.sep,
# Prevents this being recognized as a text file.
'Source/WebCore/GNUmakefile.features.am.in',
]
# Extensions of files which are allowed to contain carriage returns.
......@@ -398,13 +374,6 @@ class CheckerDispatcher(object):
return True
return False
def should_skip_with_warning(self, file_path):
"""Return whether the given file should be skipped with a warning."""
for skipped_file in _SKIPPED_FILES_WITH_WARNING:
if self._should_skip_file_path(file_path, skipped_file):
return True
return False
def should_skip_without_warning(self, file_path):
"""Return whether the given file should be skipped without a warning."""
if not self._file_type(file_path): # FileType.NONE.
......@@ -681,9 +650,6 @@ class StyleProcessor(ProcessorBase):
"""Return whether the file should be checked for style."""
if self._dispatcher.should_skip_without_warning(file_path):
return False
if self._dispatcher.should_skip_with_warning(file_path):
_log.warning('File exempt from style guide. Skipping: "%s"', file_path)
return False
return True
def process(self, lines, file_path, line_numbers=None):
......
......@@ -245,34 +245,6 @@ class CheckerDispatcherSkipTest(unittest.TestCase):
def setUp(self):
self._dispatcher = CheckerDispatcher()
def test_should_skip_with_warning(self):
"""Test should_skip_with_warning()."""
# Check skipped files.
paths_to_skip = [
"Source/WebKit/gtk/tests/testatk.c",
"Source/WebKit2/UIProcess/API/gtk/webkit2.h",
"Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h",
"Source/WebKit2/UIProcess/API/gtk/WebKitLoader.h",
]
for path in paths_to_skip:
self.assertTrue(self._dispatcher.should_skip_with_warning(path),
"Checking: " + path)
# Verify that some files are not skipped.
paths_not_to_skip = [
"foo.txt",
"Source/WebKit2/UIProcess/API/gtk/HelperClass.cpp",
"Source/WebKit2/UIProcess/API/gtk/HelperClass.h",
"Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp",
"Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h",
"Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp",
"Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h",
]
for path in paths_not_to_skip:
self.assertFalse(self._dispatcher.should_skip_with_warning(path))
def _assert_should_skip_without_warning(self, path, is_checker_none,
expected):
# Check the file type before asserting the return value.
......@@ -649,9 +621,6 @@ class StyleProcessor_CodeCoverageTest(LoggingTestCase):
def __init__(self):
self.dispatched_checker = None
def should_skip_with_warning(self, file_path):
return file_path.endswith('skip_with_warning.txt')
def should_skip_without_warning(self, file_path):
return file_path.endswith('skip_without_warning.txt')
......@@ -743,15 +712,6 @@ class StyleProcessor_CodeCoverageTest(LoggingTestCase):
self.assertFalse(self._processor.should_process(file_path))
def test_should_process__skip_with_warning(self):
"""Test should_process() for a skip-with-warning file."""
file_path = "foo/skip_with_warning.txt"
self.assertFalse(self._processor.should_process(file_path))
self.assertLog(['WARNING: File exempt from style guide. '
'Skipping: "foo/skip_with_warning.txt"\n'])
def test_should_process__true_result(self):
"""Test should_process() for a file that should be processed."""
file_path = "foo/skip_process.txt"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment