diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 9fe721f8..61d55cc9 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -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