Skip to content

Commit

Permalink
Add support to pyflakes 2.2.0
Browse files Browse the repository at this point in the history
Now, it outputs the column number.
  • Loading branch information
cemsbr committed Apr 26, 2020
1 parent 2946d1f commit 2166bb7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 9 additions & 5 deletions tests/acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
3 changes: 2 additions & 1 deletion yala/linters.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def parse(self, lines):
pattern = re.compile(r'''
^(?P<path>.+?)
:(?P<line_nr>\d+?)
:\ (?P<msg>.+)$''', re.VERBOSE)
:(?P<col>\d+?)?
\ (?P<msg>.+)$''', re.VERBOSE)
return self._parse_by_pattern(lines, pattern)


Expand Down

0 comments on commit 2166bb7

Please sign in to comment.