Checker python/flake8: allow multi-letter error codes.
This commit is contained in:
parent
b7b473b268
commit
b01520f6a3
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-108'
|
||||
let g:_SYNTASTIC_VERSION = '3.8.0-109'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
@ -23,10 +23,8 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f:%l: could not compile,%-Z%p^,' .
|
||||
\ '%A%f:%l:%c: %t%n: %m,' .
|
||||
\ '%A%f:%l:%c: %t%n %m,' .
|
||||
\ '%A%f:%l: %t%n: %m,' .
|
||||
\ '%A%f:%l: %t%n %m,' .
|
||||
\ '%A%f:%l:%c: %m,' .
|
||||
\ '%A%f:%l: %m,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
@ -37,23 +35,21 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
|
||||
\ 'env': env })
|
||||
|
||||
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
|
||||
" H*** are OpenStack messages
|
||||
" flake8 codes: https://gitlab.com/pycqa/flake8/issues/339
|
||||
|
||||
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 parts = matchlist(e['text'], '\v\C^([A-Z]+)(\d+):?\s+(.*)')
|
||||
if len(parts) >= 4
|
||||
let e['type'] = parts[1][0]
|
||||
let e['text'] = printf('%s [%s%03d]', parts[3], parts[1], parts[2])
|
||||
|
||||
if e['type'] ==? 'E' && parts[2] !~# '\m^9'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
call remove(e, 'nr')
|
||||
else
|
||||
let e['type'] = 'E'
|
||||
endif
|
||||
|
||||
if e['type'] =~? '\m^[CHNW]'
|
||||
if e['type'] =~? '\m^[CHIMNRTW]'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user