Merge pull request #2215 from irwand/master

support older flake8 output, still used by hacking module from openstack style guide
This commit is contained in:
w0rp 2019-01-27 10:57:42 +00:00 committed by GitHub
commit d882c434a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -89,7 +89,7 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
" Matches patterns line the following: " Matches patterns line the following:
" "
" stdin:6:6: E111 indentation is not a multiple of four " stdin:6:6: E111 indentation is not a multiple of four
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+) (.*)$' let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)

View File

@ -258,3 +258,19 @@ Execute(E112 should be a syntax error):
\ ale_linters#python#flake8#Handle(bufnr(''), [ \ ale_linters#python#flake8#Handle(bufnr(''), [
\ 'foo.py:6:1: E112 expected an indented block', \ 'foo.py:6:1: E112 expected an indented block',
\ ]) \ ])
Execute(Compatibility with hacking which uses older style flake8):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 1,
\ 'vcol': 1,
\ 'code': 'H306',
\ 'type': 'W',
\ 'text': 'imports not in alphabetical order (smtplib, io)',
\ },
\ ],
\ ale_linters#python#flake8#Handle(bufnr(''), [
\ 'foo.py:6:1: H306: imports not in alphabetical order (smtplib, io)',
\ ])