From 3a03fee48c24d0116c529769664750a43a206ee7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 09:14:52 +0300 Subject: [PATCH] Adjust for newer weirdness in the python/pylama checker. --- syntax_checkers/python/pylama.vim | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index 4d7d02ad2..8c8e2ba0a 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -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