From 2166bb7388791c484ed36e383db8c2f1a37baed5 Mon Sep 17 00:00:00 2001 From: "Carlos Eduardo M. Santos" Date: Sun, 26 Apr 2020 18:14:27 -0300 Subject: [PATCH] Add support to pyflakes 2.2.0 Now, it outputs the column number. --- CHANGELOG.md | 1 + tests/acceptance.py | 14 +++++++++----- yala/linters.py | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7363de..0f834c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Multiline results in pylint were not being captured, e.g. bad-whitespace and bad-continuation. +- Updated pyflakes output parser: now there's a column number. ### Changed - Pipfile has Python 3.8 now that it is available in Ubuntu LTS 20.04. However, diff --git a/tests/acceptance.py b/tests/acceptance.py index c5d9591..15079f1 100644 --- a/tests/acceptance.py +++ b/tests/acceptance.py @@ -97,11 +97,15 @@ def test_pydocstyle(self): def test_pyflakes(self): """Check Pyflakes output.""" - expected = ( - "1:None|'os' imported but unused", - "2:None|'abc' imported but unused" - ) - self._assert_results(expected, 'pyflakes') + expected_any = ( + "1:1|'os' imported but unused", # pyflakes 2.2.0 + "1:None|'os' imported but unused") # pyflakes 2.1.1 + self._assert_any_result(expected_any, 'pyflakes') + + expected_any = ( + "2:1|'abc' imported but unused", + "2:None|'abc' imported but unused") + self._assert_any_result(expected_any, 'pyflakes') def test_pylint(self): """Check Pylint output.""" diff --git a/yala/linters.py b/yala/linters.py index 3fc2acd..784f877 100644 --- a/yala/linters.py +++ b/yala/linters.py @@ -103,7 +103,8 @@ def parse(self, lines): pattern = re.compile(r''' ^(?P.+?) :(?P\d+?) - :\ (?P.+)$''', re.VERBOSE) + :(?P\d+?)? + \ (?P.+)$''', re.VERBOSE) return self._parse_by_pattern(lines, pattern)