2012-02-20 10:20:48 +00:00
|
|
|
"============================================================================
|
|
|
|
"File: pylint.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"Author: Parantapa Bhattacharya <parantapa at gmail dot com>
|
|
|
|
"
|
|
|
|
"============================================================================
|
2013-02-21 15:50:41 +00:00
|
|
|
if exists("g:loaded_syntastic_python_pylint_checker")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:loaded_syntastic_python_pylint_checker=1
|
|
|
|
|
2013-01-24 00:01:30 +00:00
|
|
|
function! SyntaxCheckers_python_pylint_IsAvailable()
|
|
|
|
return executable('pylint')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! SyntaxCheckers_python_pylint_GetLocList()
|
2013-01-20 11:07:05 +00:00
|
|
|
let makeprg = syntastic#makeprg#build({
|
2013-05-10 14:11:07 +03:00
|
|
|
\ 'exe': 'pylint',
|
|
|
|
\ 'args': ' -f parseable -r n -i y',
|
|
|
|
\ 'subchecker': 'pylint' })
|
2013-04-10 11:48:17 +03:00
|
|
|
let errorformat =
|
2013-05-10 14:11:07 +03:00
|
|
|
\ '%A%f:%l:%m,' .
|
|
|
|
\ '%A%f:(%l):%m,' .
|
|
|
|
\ '%-Z%p^%.%#,' .
|
|
|
|
\ '%-G%.%#'
|
2013-01-20 11:07:05 +00:00
|
|
|
|
2013-05-10 14:11:07 +03:00
|
|
|
let loclist=SyntasticMake({
|
|
|
|
\ 'makeprg': makeprg,
|
|
|
|
\ 'errorformat': errorformat,
|
|
|
|
\ 'postprocess': ['sort'] })
|
2013-02-06 15:29:56 +02:00
|
|
|
|
2013-04-15 11:21:52 +03:00
|
|
|
for n in range(len(loclist))
|
2013-02-06 15:48:58 +02:00
|
|
|
let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][2]) >= 0 ? 'W' : 'E'
|
2013-04-15 11:21:52 +03:00
|
|
|
endfor
|
2013-01-20 12:27:19 +00:00
|
|
|
|
2013-05-10 14:11:07 +03:00
|
|
|
return loclist
|
2013-01-20 12:27:19 +00:00
|
|
|
endfunction
|
2013-01-24 00:01:30 +00:00
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'python',
|
2013-01-27 20:08:30 +00:00
|
|
|
\ 'name': 'pylint' })
|