Skip to content

Commit 3a03fee

Browse files
committed
Adjust for newer weirdness in the python/pylama checker.
1 parent 8fb6504 commit 3a03fee

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

syntax_checkers/python/pylama.vim

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
" See http://sam.zoy.org/wtfpl/COPYING for more details.
1010
"
1111
"============================================================================
12-
if exists("g:loaded_syntastic_python_pylama_checker")
12+
if exists('g:loaded_syntastic_python_pylama_checker')
1313
finish
1414
endif
15-
let g:loaded_syntastic_python_pylama_checker=1
15+
let g:loaded_syntastic_python_pylama_checker = 1
1616

1717
function! SyntaxCheckers_python_pylama_IsAvailable()
1818
return executable('pylama')
@@ -25,20 +25,34 @@ endfunction
2525
function! SyntaxCheckers_python_pylama_GetLocList()
2626
let makeprg = syntastic#makeprg#build({
2727
\ 'exe': 'pylama',
28-
\ 'post_args': ' -f pep8',
28+
\ 'post_args': '-f pep8',
2929
\ 'filetype': 'python',
3030
\ 'subchecker': 'pylama' })
3131

32-
let errorformat = '%A%f:%l:%c: %m'
32+
" TODO: "WARNING:pylama:..." messages are probably a logging bug
33+
let errorformat =
34+
\ '%-GWARNING:pylama:%.%#,' .
35+
\ '%A%f:%l:%c: %m'
3336

34-
let loclist=SyntasticMake({
37+
let loclist = SyntasticMake({
3538
\ 'makeprg': makeprg,
3639
\ 'errorformat': errorformat,
3740
\ 'postprocess': ['sort'] })
3841

42+
" adjust for weirdness in each checker
3943
for n in range(len(loclist))
4044
let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E'
41-
if loclist[n]['text'] =~# '\v\[%(pep8|pep257|mccabe)\]$'
45+
if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$'
46+
if has_key(loclist[n], 'col')
47+
let loclist[n]['col'] += 1
48+
endif
49+
endif
50+
if loclist[n]['text'] =~# '\v\[pylint\]$'
51+
if has_key(loclist[n], 'vcol')
52+
let loclist[n]['vcol'] = 0
53+
endif
54+
endif
55+
if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pep8)\]$'
4256
let loclist[n]['subtype'] = 'Style'
4357
endif
4458
endfor

0 commit comments

Comments
 (0)