diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 923664d4..1cf768c0 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -14,15 +14,17 @@ function! SyntaxCheckers_python_pylint_IsAvailable() endfunction function! SyntaxCheckers_python_pylint_GetLocList() + let pylint_new = s:PylintNew() + let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylint', - \ 'args': ' -f parseable -r n -i y', + \ 'args': (pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'), \ 'filetype': 'python', \ 'subchecker': 'pylint' }) let errorformat = - \ '%A%f:%l:%m,' . - \ '%A%f:(%l):%m,' . + \ '%A%f:%l: %m,' . + \ '%A%f:(%l): %m,' . \ '%-Z%p^%.%#,' . \ '%-G%.%#' @@ -32,12 +34,18 @@ function! SyntaxCheckers_python_pylint_GetLocList() \ 'postprocess': ['sort'] }) for n in range(len(loclist)) - let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][2]) >= 0 ? 'W' : 'E' + let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][1]) >= 0 ? 'W' : 'E' + let loclist[n]['vcol'] = 0 endfor return loclist endfunction +function s:PylintNew() + let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0] + return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) +endfunction + call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pylint' })