summaryrefslogtreecommitdiff
path: root/ale_linters/python
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-15 17:47:24 +0000
committerw0rp <devw0rp@gmail.com>2017-11-15 17:47:24 +0000
commit1d65e5692f7075bad6806d88eb11961ea32d3e7d (patch)
tree1672dc53b158e572b98f85bd02b05c56a271e48b /ale_linters/python
parentcf538c3a58d61cfe1a77d79455efb9175479fba3 (diff)
downloadale-1d65e5692f7075bad6806d88eb11961ea32d3e7d.zip
#852 Capture error codes for pycodestyle, and consider every code except E999 to be style errors or warnings
Diffstat (limited to 'ale_linters/python')
-rw-r--r--ale_linters/python/pycodestyle.vim19
1 files changed, 14 insertions, 5 deletions
diff --git a/ale_linters/python/pycodestyle.vim b/ale_linters/python/pycodestyle.vim
index ad895999..0382e9d0 100644
--- a/ale_linters/python/pycodestyle.vim
+++ b/ale_linters/python/pycodestyle.vim
@@ -17,18 +17,27 @@ function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
endfunction
function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort
- let l:pattern = '\v^(\S*):(\d*):(\d*): ((([EW])\d+) .*)$'
+ let l:pattern = '\v^(\S*):(\d*):(\d*): ([EW]\d+) (.*)$'
let l:output = []
" lines are formatted as follows:
" file.py:21:26: W291 trailing whitespace
for l:match in ale#util#GetMatches(a:lines, l:pattern)
- call add(l:output, {
+ let l:item = {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
- \ 'type': l:match[6],
- \ 'text': l:match[4],
- \})
+ \ 'type': l:match[4][0],
+ \ 'sub_type': 'style',
+ \ 'text': l:match[5],
+ \ 'code': l:match[4],
+ \}
+
+ " E999 is not a style error, it's a syntax error.
+ if l:match[4] is# 'E999'
+ unlet l:item.sub_type
+ endif
+
+ call add(l:output, l:item)
endfor
return l:output