Adjust for newer weirdness in the python/pylama checker.

This commit is contained in:
LCD 47 2013-08-16 09:14:52 +03:00
parent 8fb6504f63
commit 3a03fee48c

View File

@ -9,10 +9,10 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_python_pylama_checker")
if exists('g:loaded_syntastic_python_pylama_checker')
finish
endif
let g:loaded_syntastic_python_pylama_checker=1
let g:loaded_syntastic_python_pylama_checker = 1
function! SyntaxCheckers_python_pylama_IsAvailable()
return executable('pylama')
@ -25,20 +25,34 @@ endfunction
function! SyntaxCheckers_python_pylama_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'pylama',
\ 'post_args': ' -f pep8',
\ 'post_args': '-f pep8',
\ 'filetype': 'python',
\ 'subchecker': 'pylama' })
let errorformat = '%A%f:%l:%c: %m'
" TODO: "WARNING:pylama:..." messages are probably a logging bug
let errorformat =
\ '%-GWARNING:pylama:%.%#,' .
\ '%A%f:%l:%c: %m'
let loclist=SyntasticMake({
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['sort'] })
" adjust for weirdness in each checker
for n in range(len(loclist))
let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E'
if loclist[n]['text'] =~# '\v\[%(pep8|pep257|mccabe)\]$'
if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$'
if has_key(loclist[n], 'col')
let loclist[n]['col'] += 1
endif
endif
if loclist[n]['text'] =~# '\v\[pylint\]$'
if has_key(loclist[n], 'vcol')
let loclist[n]['vcol'] = 0
endif
endif
if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pep8)\]$'
let loclist[n]['subtype'] = 'Style'
endif
endfor