You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.7 KiB
VimL
63 lines
1.7 KiB
VimL
11 years ago
|
"============================================================================
|
||
|
"File: pep257.vim
|
||
|
"Description: Docstring style checking plugin for syntastic.vim
|
||
|
"============================================================================
|
||
|
"
|
||
|
" For details about pep257 see: https://github.com/GreenSteam/pep257
|
||
|
|
||
11 years ago
|
if exists('g:loaded_syntastic_python_pep257_checker')
|
||
11 years ago
|
finish
|
||
|
endif
|
||
|
let g:loaded_syntastic_python_pep257_checker = 1
|
||
|
|
||
|
let s:save_cpo = &cpo
|
||
|
set cpo&vim
|
||
|
|
||
|
function! SyntaxCheckers_python_pep257_GetLocList() dict
|
||
11 years ago
|
if !exists('s:pep257_new')
|
||
|
let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion(
|
||
|
\ self.getExecEscaped() . ' --version'), [0, 3])
|
||
|
endif
|
||
|
|
||
11 years ago
|
let makeprg = self.makeprgBuild({})
|
||
|
|
||
11 years ago
|
if s:pep257_new
|
||
|
let errorformat =
|
||
|
\ '%E%f:%l %.%#:,' .
|
||
|
\ '%+C %m'
|
||
|
else
|
||
|
let errorformat =
|
||
|
\ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' .
|
||
|
\ '%E%f:%l:%c: %m,' .
|
||
|
\ '%+C %m'
|
||
|
endif
|
||
|
|
||
|
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||
11 years ago
|
|
||
|
let loclist = SyntasticMake({
|
||
|
\ 'makeprg': makeprg,
|
||
|
\ 'errorformat': errorformat,
|
||
11 years ago
|
\ 'env': env,
|
||
11 years ago
|
\ 'subtype': 'Style',
|
||
11 years ago
|
\ 'preprocess': 'killEmpty',
|
||
11 years ago
|
\ 'postprocess': ['compressWhitespace'] })
|
||
|
|
||
11 years ago
|
if s:pep257_new == 0
|
||
|
" byte offsets rather than column numbers
|
||
|
for e in loclist
|
||
|
let e['col'] = get(e, 'col', 0) + 1
|
||
|
endfor
|
||
|
endif
|
||
11 years ago
|
|
||
|
return loclist
|
||
|
endfunction
|
||
|
|
||
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||
|
\ 'filetype': 'python',
|
||
|
\ 'name': 'pep257'})
|
||
|
|
||
|
let &cpo = s:save_cpo
|
||
|
unlet s:save_cpo
|
||
|
|
||
|
" vim: set et sts=4 sw=4:
|