syntastic/syntax_checkers/python/mypy.vim

44 lines
1.3 KiB
VimL
Raw Normal View History

2014-09-27 22:35:51 -04:00
"============================================================================
"File: mypy.vim
2017-09-15 14:04:16 -04:00
"Description: Syntax checking plugin for syntastic
2014-09-27 22:35:51 -04:00
"Author: Russ Hewgill <Russ dot Hewgill at gmail dot com>
"
"============================================================================
2015-03-25 12:44:34 -04:00
if exists('g:loaded_syntastic_python_mypy_checker')
2014-09-27 22:35:51 -04:00
finish
endif
let g:loaded_syntastic_python_mypy_checker = 1
2014-09-28 04:28:26 -04:00
let s:save_cpo = &cpo
set cpo&vim
2014-09-27 22:35:51 -04:00
function! SyntaxCheckers_python_mypy_GetLocList() dict
if !exists('s:mypy_new')
" creative versioning: version string has changed from v0.4.6 to v0.470
" XXX the test should be fine for now, since 470 > 4
let s:mypy_new = syntastic#util#versionIsAtLeast(self.getVersion(), [0, 4, 5])
endif
2014-09-27 22:35:51 -04:00
let makeprg = self.makeprgBuild({ 'args_after': (s:mypy_new ? '--show-column-numbers' : '') })
let errorformat =
\ '%f:%l:%c:%t:%m,' .
\ '%f:%l:%t:%m'
2014-09-27 22:35:51 -04:00
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1],
\ 'preprocess': 'mypy' })
2014-09-27 22:35:51 -04:00
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'python',
\ 'name': 'mypy'})
2014-09-28 04:28:26 -04:00
let &cpo = s:save_cpo
unlet s:save_cpo
2014-09-27 22:35:51 -04:00
2015-01-04 05:46:54 -05:00
" vim: set sw=4 sts=4 et fdm=marker: