2012-02-20 05:20:48 -05:00
|
|
|
"============================================================================
|
|
|
|
"File: pylint.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"Author: Parantapa Bhattacharya <parantapa at gmail dot com>
|
|
|
|
"
|
|
|
|
"============================================================================
|
2013-01-23 19:01:30 -05:00
|
|
|
function! SyntaxCheckers_python_pylint_IsAvailable()
|
|
|
|
return executable('pylint')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! SyntaxCheckers_python_pylint_GetLocList()
|
2013-01-20 06:07:05 -05:00
|
|
|
let makeprg = syntastic#makeprg#build({
|
|
|
|
\ 'exe': 'pylint',
|
2013-01-27 15:08:30 -05:00
|
|
|
\ 'args': ' -f parseable -r n -i y',
|
2013-01-20 06:07:05 -05:00
|
|
|
\ 'subchecker': 'pylint' })
|
2013-02-06 08:29:56 -05:00
|
|
|
let errorformat = '%f:%l:%m,%Z,%-GNo config %m'
|
2013-01-20 06:07:05 -05:00
|
|
|
|
2013-02-06 08:29:56 -05:00
|
|
|
let loclist=SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
|
|
|
|
|
|
|
let n = len(loclist) - 1
|
|
|
|
while n >= 0
|
2013-02-06 08:48:58 -05:00
|
|
|
let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][2]) >= 0 ? 'W' : 'E'
|
2013-02-06 08:29:56 -05:00
|
|
|
let n -= 1
|
|
|
|
endwhile
|
2013-01-20 07:27:19 -05:00
|
|
|
|
2013-02-06 09:27:49 -05:00
|
|
|
return sort(loclist, 's:CmpLoclist')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! s:CmpLoclist(a, b)
|
|
|
|
return a:a['lnum'] - a:b['lnum']
|
2013-01-20 07:27:19 -05:00
|
|
|
endfunction
|
2013-01-23 19:01:30 -05:00
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'python',
|
2013-01-27 15:08:30 -05:00
|
|
|
\ 'name': 'pylint' })
|