Adjust for newer weirdness in the python/pylama checker.
This commit is contained in:
parent
8fb6504f63
commit
3a03fee48c
@ -9,10 +9,10 @@
|
|||||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
" 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
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_syntastic_python_pylama_checker=1
|
let g:loaded_syntastic_python_pylama_checker = 1
|
||||||
|
|
||||||
function! SyntaxCheckers_python_pylama_IsAvailable()
|
function! SyntaxCheckers_python_pylama_IsAvailable()
|
||||||
return executable('pylama')
|
return executable('pylama')
|
||||||
@ -25,20 +25,34 @@ endfunction
|
|||||||
function! SyntaxCheckers_python_pylama_GetLocList()
|
function! SyntaxCheckers_python_pylama_GetLocList()
|
||||||
let makeprg = syntastic#makeprg#build({
|
let makeprg = syntastic#makeprg#build({
|
||||||
\ 'exe': 'pylama',
|
\ 'exe': 'pylama',
|
||||||
\ 'post_args': ' -f pep8',
|
\ 'post_args': '-f pep8',
|
||||||
\ 'filetype': 'python',
|
\ 'filetype': 'python',
|
||||||
\ 'subchecker': 'pylama' })
|
\ '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,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
\ 'postprocess': ['sort'] })
|
\ 'postprocess': ['sort'] })
|
||||||
|
|
||||||
|
" adjust for weirdness in each checker
|
||||||
for n in range(len(loclist))
|
for n in range(len(loclist))
|
||||||
let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E'
|
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'
|
let loclist[n]['subtype'] = 'Style'
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user