Rework of message decoding for flake8.
This commit is contained in:
parent
2d9ff2457f
commit
ab94210085
@ -23,15 +23,38 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l: could not compile,%-Z%p^,' .
|
||||
\ '%E%f:%l:%c: F%n %m,' .
|
||||
\ '%W%f:%l:%c: C%n %m,' .
|
||||
\ '%W%f:%l:%c: %.%n %m,' .
|
||||
\ '%W%f:%l: %.%n %m,' .
|
||||
\ '%A%f:%l:%c: %t%n %m,' .
|
||||
\ '%A%f:%l: %t%n %m,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
return SyntasticMake({
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
|
||||
for e in loclist
|
||||
" E*** and W*** are pep8 errors
|
||||
" F*** are PyFlakes codes
|
||||
" C*** are McCabe complexity messages
|
||||
" N*** are naming conventions from pep8-naming
|
||||
|
||||
if has_key(e, 'nr')
|
||||
let e['text'] .= printf(' [%s%03d]', e['type'], e['nr'])
|
||||
" E901 are syntax errors
|
||||
" E902 are I/O errors
|
||||
if e['type'] ==? 'E' && e['nr'] !~ '\m^9'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
call remove(e, 'nr')
|
||||
endif
|
||||
|
||||
if e['type'] =~? '\m^[CNW]'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
|
||||
let e['type'] = e['type'] =~? '\m^[EFC]' ? 'E' : 'W'
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
runtime! syntax_checkers/python/pyflakes.vim
|
||||
|
Loading…
x
Reference in New Issue
Block a user