Cleaner error handling for pylint.

This commit is contained in:
LCD 47 2013-09-20 07:49:19 +03:00
parent 0048156d8f
commit 3eb51f1e26

View File

@ -7,18 +7,19 @@
if exists("g:loaded_syntastic_python_pylint_checker")
finish
endif
let g:loaded_syntastic_python_pylint_checker=1
let g:loaded_syntastic_python_pylint_checker = 1
let s:pylint_new = -1
function! SyntaxCheckers_python_pylint_IsAvailable()
return executable('pylint')
let s:pylint_new = executable('pylint') ? s:PylintNew() : -1
return s:pylint_new >= 0
endfunction
function! SyntaxCheckers_python_pylint_GetLocList()
let pylint_new = s:PylintNew()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'pylint',
\ 'args': (pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'),
\ 'args': (s:pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'),
\ 'filetype': 'python',
\ 'subchecker': 'pylint' })
@ -51,10 +52,12 @@ endfunction
function s:PylintNew()
try
let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0]
return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1])
let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1])
catch /E684/
return 0
call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)")
let ret = -1
endtry
return ret
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({