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({
|
|
|
|
\ 'exe': 'pylint',
|
2013-01-27 20:08:30 +00:00
|
|
|
\ 'args': ' -f parseable -r n -i y',
|
2013-01-20 11:07:05 +00:00
|
|
|
\ 'subchecker': 'pylint' })
|
2013-04-10 11:48:17 +03:00
|
|
|
let errorformat =
|
|
|
|
\ '%A%f:%l:%m,' .
|
|
|
|
\ '%A%f:(%l):%m,' .
|
|
|
|
\ '%-Z%p^%.%#,' .
|
|
|
|
\ '%-G%.%#'
|
2013-01-20 11:07:05 +00:00
|
|
|
|
2013-02-06 15:29:56 +02:00
|
|
|
let loclist=SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
|
|
|
|
|
|
|
let n = len(loclist) - 1
|
|
|
|
while n >= 0
|
2013-02-06 15:48:58 +02:00
|
|
|
let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][2]) >= 0 ? 'W' : 'E'
|
2013-02-06 15:29:56 +02:00
|
|
|
let n -= 1
|
|
|
|
endwhile
|
2013-01-20 12:27:19 +00:00
|
|
|
|
2013-02-06 16:27:49 +02:00
|
|
|
return sort(loclist, 's:CmpLoclist')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:CmpLoclist(a, b)
|
|
|
|
return a:a['lnum'] - a:b['lnum']
|
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' })
|