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
|
lockvar! g:_SYNTASTIC_START
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:_SYNTASTIC_VERSION = '3.8.0-108'
|
let g:_SYNTASTIC_VERSION = '3.8.0-109'
|
||||||
lockvar g:_SYNTASTIC_VERSION
|
lockvar g:_SYNTASTIC_VERSION
|
||||||
|
|
||||||
" Sanity checks {{{1
|
" Sanity checks {{{1
|
||||||
|
@ -23,10 +23,8 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
|
|||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%E%f:%l: could not compile,%-Z%p^,' .
|
\ '%E%f:%l: could not compile,%-Z%p^,' .
|
||||||
\ '%A%f:%l:%c: %t%n: %m,' .
|
\ '%A%f:%l:%c: %m,' .
|
||||||
\ '%A%f:%l:%c: %t%n %m,' .
|
\ '%A%f:%l: %m,' .
|
||||||
\ '%A%f:%l: %t%n: %m,' .
|
|
||||||
\ '%A%f:%l: %t%n %m,' .
|
|
||||||
\ '%-G%.%#'
|
\ '%-G%.%#'
|
||||||
|
|
||||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||||
@ -37,23 +35,21 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict
|
|||||||
\ 'env': env })
|
\ 'env': env })
|
||||||
|
|
||||||
for e in loclist
|
for e in loclist
|
||||||
" E*** and W*** are pep8 errors
|
" flake8 codes: https://gitlab.com/pycqa/flake8/issues/339
|
||||||
" F*** are PyFlakes codes
|
|
||||||
" C*** are McCabe complexity messages
|
|
||||||
" N*** are naming conventions from pep8-naming
|
|
||||||
" H*** are OpenStack messages
|
|
||||||
|
|
||||||
if has_key(e, 'nr')
|
let parts = matchlist(e['text'], '\v\C^([A-Z]+)(\d+):?\s+(.*)')
|
||||||
let e['text'] .= printf(' [%s%03d]', e['type'], e['nr'])
|
if len(parts) >= 4
|
||||||
" E901 are syntax errors
|
let e['type'] = parts[1][0]
|
||||||
" E902 are I/O errors
|
let e['text'] = printf('%s [%s%03d]', parts[3], parts[1], parts[2])
|
||||||
if e['type'] ==? 'E' && e['nr'] !~# '\m^9'
|
|
||||||
|
if e['type'] ==? 'E' && parts[2] !~# '\m^9'
|
||||||
let e['subtype'] = 'Style'
|
let e['subtype'] = 'Style'
|
||||||
endif
|
endif
|
||||||
call remove(e, 'nr')
|
else
|
||||||
|
let e['type'] = 'E'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if e['type'] =~? '\m^[CHNW]'
|
if e['type'] =~? '\m^[CHIMNRTW]'
|
||||||
let e['subtype'] = 'Style'
|
let e['subtype'] = 'Style'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user