Diff
Modified: trunk/Tools/ChangeLog (252439 => 252440)
--- trunk/Tools/ChangeLog 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/ChangeLog 2019-11-14 01:04:35 UTC (rev 252440)
@@ -1,3 +1,57 @@
+2019-11-13 Jonathan Bedard <[email protected]>
+
+ Python 3: Add support in webkitpy.style.checkers
+ https://bugs.webkit.org/show_bug.cgi?id=203761
+
+ Rubber-stamped by Stephanie Lewis.
+
+ * Scripts/test-webkitpy-python3: Add webkitpy.style.checkers.
+ * Scripts/webkitpy/port/builders.py:
+ (all_port_names): Convert map to a list before concatenating.
+ * Scripts/webkitpy/style/checkers/changelog.py: Use explicit imports.
+ * Scripts/webkitpy/style/checkers/changelog_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/cmake.py: Ditto.
+ * Scripts/webkitpy/style/checkers/cmake_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/common_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/contributors.py: Ditto.
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (Position): Add rich comparison functions.
+ (check_for_copyright): Use range instead of xrange.
+ (detect_functions): Ditto.
+ (check_language): Use r-string.
+ (check_for_include_what_you_use): Use range instead of xrange.
+ (_process_lines): Convert iterator to list, use range instead of xrange.
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (CppStyleTest): Be explicit about bytes vs strings.
+ * Scripts/webkitpy/style/checkers/js.py: Use explicit imports.
+ * Scripts/webkitpy/style/checkers/js_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/jsonchecker.py: Ditto.
+ (JSONFeaturesChecker.check):
+ * Scripts/webkitpy/style/checkers/jsonchecker_unittest.py: Ditto.
+ (JSONCheckerTest.test_conflict_marker): Differentiate between Python 2 and 3
+ json parsers.
+ * Scripts/webkitpy/style/checkers/jstest_unittest.py: Use explicit imports.
+ * Scripts/webkitpy/style/checkers/messagesin.py: Ditto.
+ * Scripts/webkitpy/style/checkers/messagesin_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/png_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/python.py:
+ (PythonChecker.check): Only run pylint in Python 2.
+ (PythonChecker._check_pylint): Use r string.
+ (Pylinter.run): Surpress logging from Pylint.
+ * Scripts/webkitpy/style/checkers/python_unittest.py: Use explicit imports.
+ (PythonCheckerTest.test_check): Add FIXME for running pylint in Python 3.
+ * Scripts/webkitpy/style/checkers/python_unittest_falsepositives.py:
+ * Scripts/webkitpy/style/checkers/python_unittest_input.py:
+ * Scripts/webkitpy/style/checkers/test_expectations.py: Use explicit imports.
+ * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/text.py: Ditto.
+ * Scripts/webkitpy/style/checkers/text_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/watchlist_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/xcodeproj_unittest.py: Ditto.
+ * Scripts/webkitpy/style/checkers/xml_unittest.py: Ditto.
+ * Scripts/webkitpy/thirdparty/__init__.py:
+ (AutoinstallImportHook._install_pep8): Update pep8 version.
+
2019-11-13 Jer Noble <[email protected]>
Link mediaDataLoadsAutomatically setting to AutoplayPolicy
Modified: trunk/Tools/Scripts/test-webkitpy-python3 (252439 => 252440)
--- trunk/Tools/Scripts/test-webkitpy-python3 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/test-webkitpy-python3 2019-11-14 01:04:35 UTC (rev 252440)
@@ -38,6 +38,7 @@
'webkitpy.layout_tests.models',
'webkitpy.port',
'webkitpy.results',
+ 'webkitpy.style.checkers',
'webkitpy.xcode',
]
SLOW_TESTS = [
Modified: trunk/Tools/Scripts/webkitpy/port/builders.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/port/builders.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/port/builders.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -102,7 +102,7 @@
def all_port_names():
- return sorted(set(map(lambda x: x["port_name"], _exact_matches.values()) + _ports_without_builders))
+ return sorted(set(list(map(lambda x: x["port_name"], _exact_matches.values())) + _ports_without_builders))
def rebaseline_override_dir(builder_name):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/changelog.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/changelog.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/changelog.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -23,9 +23,9 @@
"""Checks WebKit style for ChangeLog files."""
-from common import TabChecker, match, search, searchIgnorecase
from sys import maxsize
from webkitpy.common.checkout.changelog import parse_bug_id_from_changelog
+from webkitpy.style.checkers.common import TabChecker, match, search, searchIgnorecase
class ChangeLogChecker(object):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -23,10 +23,11 @@
"""Unit test for changelog.py."""
-import changelog
import unittest
+from webkitpy.style.checkers import changelog
+
class ChangeLogCheckerTest(unittest.TestCase):
"""Tests ChangeLogChecker class."""
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cmake.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cmake.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cmake.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -25,7 +25,7 @@
"""Supports checking WebKit style in cmake files.(.cmake, CMakeLists.txt)"""
-from common import TabChecker, match, search, searchIgnorecase
+from webkitpy.style.checkers.common import TabChecker, match, search, searchIgnorecase
class CMakeChecker(object):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -24,7 +24,7 @@
import unittest
-from cmake import CMakeChecker
+from webkitpy.style.checkers.cmake import CMakeChecker
class CMakeCheckerTest(unittest.TestCase):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/common_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/common_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/common_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -24,8 +24,8 @@
import unittest
-from common import CarriageReturnChecker
-from common import TabChecker
+from webkitpy.style.checkers.common import CarriageReturnChecker
+from webkitpy.style.checkers.common import TabChecker
# FIXME: The unit tests for the cpp, text, and common checkers should
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/contributors.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/contributors.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/contributors.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -26,7 +26,7 @@
import json
import re
from sets import Set
-from jsonchecker import JSONChecker
+from webkitpy.style.checkers.jsonchecker import JSONChecker
from webkitpy.common.config.committers import CommitterList
from webkitpy.common.system.filesystem import FileSystem
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -45,8 +45,9 @@
import sys
import unicodedata
-from common import match, search, sub, subn
+from webkitpy.style.checkers.common import match, search, sub, subn
from webkitpy.common.memoized import memoized
+from webkitpy.common.unicode_compatibility import unicode
# The key to use to provide a class to fake loading a header file.
INCLUDE_IO_INJECTION_KEY = 'include_header_io'
@@ -366,9 +367,27 @@
return '(%s, %s)' % (self.row, self.column)
def __cmp__(self, other):
- return self.row.__cmp__(other.row) or self.column.__cmp__(other.column)
+ return (self.row - other.row) or (self.column - other.column)
+ def __eq__(self, other):
+ return self.__cmp__(other) == 0
+ def __ne__(self, other):
+ return self.__cmp__(other) != 0
+
+ def __lt__(self, other):
+ return self.__cmp__(other) < 0
+
+ def __le__(self, other):
+ return self.__cmp__(other) <= 0
+
+ def __gt__(self, other):
+ return self.__cmp__(other) > 0
+
+ def __ge__(self, other):
+ return self.__cmp__(other) >= 0
+
+
class Parameter(object):
"""Information about one function parameter."""
def __init__(self, parameter, parameter_name_index, row):
@@ -897,7 +916,7 @@
# We'll say it should occur by line 10. Don't forget there's a
# dummy line at the front.
- for line in xrange(1, min(len(lines), 11)):
+ for line in range(1, min(len(lines), 11)):
if re.search(r'Copyright', lines[line], re.I):
break
else: # means no copyright line was found
@@ -1596,7 +1615,7 @@
return
joined_line = ''
- for start_line_number in xrange(line_number, clean_lines.num_lines()):
+ for start_line_number in range(line_number, clean_lines.num_lines()):
start_line = clean_lines.elided[start_line_number]
joined_line += ' ' + start_line.lstrip()
body_match = search(r'{|;', start_line)
@@ -3369,7 +3388,7 @@
nested_angle_bracket_count = 1
previous_closing_angle_bracket_index = -1
closing_angle_bracket_index = 9 # Used if only one pair of angle brackets.
- for i in xrange(10, len(match_line) - 1):
+ for i in range(10, len(match_line) - 1):
if match_line[i] == '<':
nested_angle_bracket_count += 1
if match_line[i] == '>':
@@ -3382,7 +3401,7 @@
'RetainPtr<> should never contain a type with \'*\'. Correct: RetainPtr<NSString>, RetainPtr<CFStringRef>.')
break
- matched = re.compile('^\s*SOFT_LINK_(PRIVATE_)?FRAMEWORK.*\((\S+)\)').search(line)
+ matched = re.compile(r'^\s*SOFT_LINK_(PRIVATE_)?FRAMEWORK.*\((\S+)\)').search(line)
if matched:
framework_name = matched.group(2)
if file_extension == 'h' and not search(r'^\s*SOFT_LINK_(PRIVATE_)?FRAMEWORK_FOR_HEADER.*\(', line):
@@ -3883,7 +3902,7 @@
required = {} # A map of header name to line_number and the template entity.
# Example of required: { '<functional>': (1219, 'less<>') }
- for line_number in xrange(clean_lines.num_lines()):
+ for line_number in range(clean_lines.num_lines()):
line = clean_lines.elided[line_number]
if not line or line[0] == '#':
continue
@@ -3926,7 +3945,7 @@
# include_state is modified during iteration, so we iterate over a copy of
# the keys.
- for header in include_state.keys(): # NOLINT
+ for header in list(include_state.keys()): # NOLINT
(same_module, common_path) = files_belong_to_same_module(abs_filename, header)
fullpath = common_path + header
if same_module and update_include_state(fullpath, include_state):
@@ -4051,7 +4070,7 @@
file_state = _FileState(clean_lines, file_extension)
enum_state = _EnumState()
asm_state = _InlineASMState()
- for line in xrange(clean_lines.num_lines()):
+ for line in range(clean_lines.num_lines()):
process_line(filename, file_extension, clean_lines, line,
include_state, function_state, class_state, file_state,
enum_state, asm_state, error)
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -40,9 +40,10 @@
import random
import re
import unittest
-import cpp as cpp_style
-from cpp import CppChecker
-from ..filter import FilterConfiguration
+from webkitpy.common.unicode_compatibility import decode_if_necessary
+from webkitpy.style.checkers import cpp as cpp_style
+from webkitpy.style.checkers.cpp import CppChecker
+from webkitpy.style.filter import FilterConfiguration
# This class works as an error collector and replaces cpp_style.Error
@@ -2447,7 +2448,7 @@
def do_test(self, raw_bytes, has_invalid_utf8):
error_collector = ErrorCollector(self.assertTrue)
self.process_file_data('foo.cpp', 'cpp',
- unicode(raw_bytes, 'utf8', 'replace').split('\n'),
+ decode_if_necessary(raw_bytes, encoding='utf8', errors='replace').split('\n'),
error_collector)
# The warning appears only once.
self.assertEqual(
@@ -2457,12 +2458,12 @@
' (or Unicode replacement character).'
' [readability/utf8] [5]'))
- do_test(self, 'Hello world\n', False)
- do_test(self, '\xe9\x8e\xbd\n', False)
- do_test(self, '\xe9x\x8e\xbd\n', True)
+ do_test(self, b'Hello world\n', False)
+ do_test(self, b'\xe9\x8e\xbd\n', False)
+ do_test(self, b'\xe9x\x8e\xbd\n', True)
# This is the encoding of the replacement character itself (which
# you can see by evaluating codecs.getencoder('utf8')(u'\ufffd')).
- do_test(self, '\xef\xbf\xbd\n', True)
+ do_test(self, b'\xef\xbf\xbd\n', True)
def test_is_blank_line(self):
self.assertTrue(cpp_style.is_blank_line(''))
@@ -2786,7 +2787,7 @@
other_decl_specs = [random.choice(qualifiers), random.choice(signs),
random.choice(types)]
# remove None
- other_decl_specs = filter(lambda x: x is not None, other_decl_specs)
+ other_decl_specs = list(filter(lambda x: x is not None, other_decl_specs))
# shuffle
random.shuffle(other_decl_specs)
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/js.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/js.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/js.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -30,8 +30,8 @@
This checker is only used to check WebInspector _javascript_ files.
"""
-from common import TabChecker
import re
+from webkitpy.style.checkers.common import TabChecker
class JSChecker(object):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/js_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/js_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/js_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -31,7 +31,7 @@
import unittest
-from js import JSChecker
+from webkitpy.style.checkers.js import JSChecker
class JSTestCase(unittest.TestCase):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -24,7 +24,6 @@
import json
import re
-from sets import Set
class JSONChecker(object):
@@ -70,7 +69,7 @@
self._handle_style_error(0, 'json/syntax', 5, '"features" key not found, the key is mandatory.')
return
- specification_name_set = Set()
+ specification_name_set = set()
if 'specification' in features_definition:
previous_specification_name = ''
for specification_object in features_definition['specification']:
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -22,9 +22,10 @@
"""Unit test for jsonchecker.py."""
+import sys
import unittest
-import jsonchecker
+from webkitpy.style.checkers import jsonchecker
class MockErrorHandler(object):
@@ -81,7 +82,8 @@
pass
def test_conflict_marker(self):
- self.assert_error(0, 'json/syntax', '<<<<<<< HEAD\n{\n}\n')
+ # Python 2 0 indexes json parser errors, Python 3 1 indexes them
+ self.assert_error(1 if sys.version_info > (3, 0) else 0, 'json/syntax', '<<<<<<< HEAD\n{\n}\n')
def test_single_quote(self):
self.assert_error(2, 'json/syntax', "{\n'slaves': []\n}\n")
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jstest_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/jstest_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jstest_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -25,7 +25,7 @@
import unittest
-from jstest import map_functions_to_dict
+from webkitpy.style.checkers.jstest import map_functions_to_dict
class JSTestCheckerTestCase(unittest.TestCase):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/messagesin.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/messagesin.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/messagesin.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -25,7 +25,7 @@
"""Checks WebKit style for .messages.in files."""
import re
-from common import TabChecker
+from webkitpy.style.checkers.common import TabChecker
class MessagesInChecker(object):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/messagesin_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/messagesin_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/messagesin_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -26,7 +26,7 @@
import unittest
-from messagesin import MessagesInChecker
+from webkitpy.style.checkers.messagesin import MessagesInChecker
class MessagesInCheckerStyleTestCase(unittest.TestCase):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/png_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/png_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/png_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -25,7 +25,7 @@
import unittest
-from png import PNGChecker
+from webkitpy.style.checkers.png import PNGChecker
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.systemhost_mock import MockSystemHost
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/python.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/python.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/python.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -24,13 +24,13 @@
"""Supports checking WebKit style in Python files."""
import re
-from StringIO import StringIO
+import sys
from webkitpy.common.system.filesystem import FileSystem
+from webkitpy.common.unicode_compatibility import StringIO
+from webkitpy.common.system.outputcapture import OutputCaptureScope
from webkitpy.common.webkit_finder import WebKitFinder
from webkitpy.thirdparty.autoinstalled import pep8
-from webkitpy.thirdparty.autoinstalled.pylint import lint
-from webkitpy.thirdparty.autoinstalled.pylint.reporters.text import ParseableTextReporter
class PythonChecker(object):
@@ -41,7 +41,10 @@
def check(self, lines):
self._check_pep8(lines)
- self._check_pylint(lines)
+ # FIXME: https://bugs.webkit.org/show_bug.cgi?id=204133
+ # Pylint can't live happily in python 2 and 3 world, we need to pick one
+ if sys.version_info < (3, 0):
+ self._check_pylint(lines)
def _check_pep8(self, lines):
# Initialize pep8.options, which is necessary for
@@ -71,10 +74,11 @@
# filtering warnings using the rules in style/checker.py instead.
output = pylinter.run(['-E', self._file_path])
- lint_regex = re.compile('([^:]+):([^:]+): \[([^]]+)\] (.*)')
+ lint_regex = re.compile(r'([^:]+):([^:]+): \[([^]]+)\] (.*)')
for error in output.getvalue().splitlines():
match_obj = lint_regex.match(error)
- assert(match_obj)
+ if not match_obj:
+ continue
line_number = int(match_obj.group(2))
category_and_method = match_obj.group(3).split(', ')
category = 'pylint/' + (category_and_method[0])
@@ -104,7 +108,10 @@
def run(self, argv):
output = _FilteredStringIO(self.FALSE_POSITIVES)
- lint.Run(['--rcfile', self._pylintrc] + argv, reporter=ParseableTextReporter(output=output), exit=False)
+ with OutputCaptureScope():
+ from webkitpy.thirdparty.autoinstalled.pylint import lint
+ from webkitpy.thirdparty.autoinstalled.pylint.reporters.text import ParseableTextReporter
+ lint.Run(['--rcfile', self._pylintrc] + argv, reporter=ParseableTextReporter(output=output), exit=False)
return output
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -23,9 +23,10 @@
"""Unit tests for python.py."""
import os
+import sys
import unittest
-from python import PythonChecker
+from webkitpy.style.checkers.python import PythonChecker
class PythonCheckerTest(unittest.TestCase):
@@ -46,8 +47,7 @@
"""Test check() method."""
errors = []
- def _mock_handle_style_error(line_number, category, confidence,
- message):
+ def _mock_handle_style_error(line_number, category, confidence, message):
error = (line_number, category, confidence, message)
errors.append(error)
@@ -57,11 +57,13 @@
checker = PythonChecker(file_path, _mock_handle_style_error)
checker.check(lines=[])
- self.assertEqual(errors, [
- (4, "pep8/W291", 5, "trailing whitespace"),
- (4, "pylint/E0602", 5, "Undefined variable 'error'"),
- ])
+ # FIXME: https://bugs.webkit.org/show_bug.cgi?id=204133
+ expected_errors = [(4, "pep8/W291", 5, "trailing whitespace")]
+ if sys.version_info < (3, 0):
+ expected_errors.append((4, "pylint/E0602", 5, "Undefined variable 'error'"))
+ self.assertEqual(errors, expected_errors)
+
def test_pylint_false_positives(self):
"""Test that pylint false positives are suppressed."""
errors = []
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest_falsepositives.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest_falsepositives.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest_falsepositives.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -5,8 +5,11 @@
def test_popen(proc):
- p = subprocess.Popen(proc, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
+ p = subprocess.Popen(
+ proc,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ )
tmp1 = p.poll
tmp2 = p.returncode
tmp3 = p.stdin
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest_input.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest_input.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/python_unittest_input.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -1,4 +1,4 @@
# This file is sample input for python_unittest.py and includes two
# problems, one that will generate a PEP-8 warning for trailing whitespace
# and one that will generate a pylint error for an undefined variable.
-print error()
+print(error())
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -34,9 +34,9 @@
import re
import sys
-from common import TabChecker
from webkitpy.common.host import Host
from webkitpy.layout_tests.models import test_expectations
+from webkitpy.style.checkers.common import TabChecker
from webkitpy.style.error_handlers import DefaultStyleErrorHandler
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -30,8 +30,8 @@
import sys
import unittest
-from test_expectations import TestExpectationsChecker
from webkitpy.common.host_mock import MockHost
+from webkitpy.style.checkers.test_expectations import TestExpectationsChecker
class ErrorCollector(object):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/text.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/text.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/text.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -29,7 +29,7 @@
"""Checks WebKit style for text files."""
-from common import TabChecker
+from webkitpy.style.checkers.common import TabChecker
class TextChecker(object):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/text_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/text_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/text_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -30,8 +30,8 @@
import unittest
-import text as text_style
-from text import TextChecker
+from webkitpy.style.checkers import text as text_style
+from webkitpy.style.checkers.text import TextChecker
class TextStyleTestCase(unittest.TestCase):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -33,10 +33,9 @@
import unittest
+from webkitpy.style.checkers import watchlist
-import watchlist
-
class MockErrorHandler(object):
def __init__(self, handle_style_error):
self.turned_off_filtering = False
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -24,7 +24,7 @@
"""Unit test for xcodeproj.py."""
import unittest
-import xcodeproj
+from webkitpy.style.checkers import xcodeproj
class TestErrorHandler(object):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/xml_unittest.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/checkers/xml_unittest.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/xml_unittest.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -23,7 +23,7 @@
"""Unit test for xml.py."""
import unittest
-import xml
+from webkitpy.style.checkers import xml
class MockErrorHandler(object):
Modified: trunk/Tools/Scripts/webkitpy/style/optparser.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/style/optparser.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/style/optparser.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -27,7 +27,7 @@
import os.path
import sys
-from filter import validate_filter_rules
+from webkitpy.style.filter import validate_filter_rules
# This module should not import anything from checker.py.
_log = logging.getLogger(__name__)
Modified: trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py (252439 => 252440)
--- trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py 2019-11-14 00:35:07 UTC (rev 252439)
+++ trunk/Tools/Scripts/webkitpy/thirdparty/__init__.py 2019-11-14 01:04:35 UTC (rev 252440)
@@ -152,8 +152,8 @@
"keyring-7.3.1/keyring")
def _install_pep8(self):
- self._install("https://files.pythonhosted.org/packages/source/p/pep8/pep8-0.5.0.tar.gz",
- "pep8-0.5.0/pep8.py")
+ self._install("https://files.pythonhosted.org/packages/01/a0/64ba19519db49e4094d82599412a9660dee8c26a7addbbb1bf17927ceefe/pep8-1.7.1.tar.gz",
+ "pep8-1.7.1/pep8.py")
def _install_pycodestyle(self):
self._install("https://files.pythonhosted.org/packages/source/p/pycodestyle/pycodestyle-2.5.0.tar.gz",
"pycodestyle-2.5.0/pycodestyle.py")