Nimbin[12]?Mirrors & Forks / syntastic / commits / b01520f6

syntastic git · master

syntastic vim plugin (fork)

vim fork · first commit 2009-07-10 · last commit 2022-07-10 (4 years ago) · synced 3 days ago · upstream: github.com/vim-syntastic/syntastic

Vim Script 99%
git clone https://git.christianimmanuel.de/mirrors-forks/syntastic.gitwget https://git.christianimmanuel.de/mirrors-forks/syntastic/archive/syntastic.tar.gz

Checker python/flake8: allow multi-letter error codes.

LCD 47 · 2018-04-02 13:44 · b01520f6a3f196e0fee9ac859fc386aea6383fe4

 plugin/syntastic.vim              |  2 +-
 syntax_checkers/python/flake8.vim | 30 +++++++++++++-----------------
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim
index 2c4a3f74..be338025 100644
--- a/plugin/syntastic.vim
+++ b/plugin/syntastic.vim
@@ -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
diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim
index fb9f3ad2..cd651890 100644
--- a/syntax_checkers/python/flake8.vim
+++ b/syntax_checkers/python/flake8.vim
@@ -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
-
-        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'
+        " flake8 codes: https://gitlab.com/pycqa/flake8/issues/339
+
+        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