Cleanup the python/pep257 checker.
This commit is contained in:
parent
81e2e20892
commit
7dba68cffb
@ -14,21 +14,32 @@ function! SyntaxCheckers_python_pep257_IsAvailable()
|
||||
return executable('pep257')
|
||||
endfunction
|
||||
|
||||
" sanity: kill empty lines here rather than munging errorformat
|
||||
function! SyntaxCheckers_python_pep257_Preprocess(errors)
|
||||
return filter(copy(a:errors), 'v:val != ""')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_pep257_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'pep257',
|
||||
\ 'filetype': 'python',
|
||||
\ 'subchecker': 'pep257' })
|
||||
|
||||
let errorformat = '%f:%l:%c: %m'
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' .
|
||||
\ '%E%f:%l:%c: %m,' .
|
||||
\ '%+C %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style' })
|
||||
\ 'subtype': 'Style',
|
||||
\ 'preprocess': 'SyntaxCheckers_python_pep257_Preprocess',
|
||||
\ 'postprocess': ['compressWhitespace'] })
|
||||
|
||||
" pep257 outputs byte offsets rather than column numbers
|
||||
for n in range(len(loclist))
|
||||
let loclist[n]['type'] = loclist[n]['text'] =~? '^W' ? 'W' : 'E'
|
||||
let loclist[n]['col'] = get(loclist[n], 'col', 0) + 1
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
|
Loading…
Reference in New Issue
Block a user