From e380a861809990a9f127382427ecf3583a8880d1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 31 Jul 2013 16:32:36 +0300 Subject: [PATCH 1/4] Shell escaping is safer since commit a1e1108. --- syntax_checkers/eruby/ruby.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 3a772351..ffde7350 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -44,7 +44,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() \ exe . ' -rerb -e ' . \ syntastic#util#shescape('puts ERB.new(File.read(' . \ fname . encoding_spec . - \ ').gsub(''<\%='',''<\%''), nil, ''-'').src') . + \ ').gsub(''<%='',''<%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' let errorformat = From de9d56121b70be26d776d9e970e3c70b98df3ad2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 5 Aug 2013 09:25:33 +0300 Subject: [PATCH 2/4] Add option "syntastic_aggregate_errors". --- doc/syntastic.txt | 11 ++++++++++- plugin/syntastic.vim | 23 ++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 4f3645eb..24fa57c2 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -177,6 +177,15 @@ variable to 0. > let g:syntastic_check_on_wq=0 < + *'syntastic_aggregate_errors'* +Default: 0 +When enabled, |:SyntasticCheck| runs all checkers that apply, then aggregates +errors found by all checkers and displays them. When disabled, +|:SyntasticCheck| runs each checker in turn, and stops to display the results +the first time a checker finds any errors. > + let g:syntastic_aggregate_errors=1 +< + *'syntastic_echo_current_error'* Default: 1 If enabled, syntastic will echo the error associated with the current line to @@ -295,7 +304,7 @@ The option should be set to something like: > "mode" can be mapped to one of two values - "active" or "passive". When set to active, syntastic does automatic checking whenever a buffer is saved or initially opened. When set to "passive" syntastic only checks when the user -calls :SyntasticCheck. +calls |:SyntasticCheck|. The exceptions to these rules are defined with "active_filetypes" and "passive_filetypes". In passive mode, automatic checks are still done diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 514c6c18..ec93a9f0 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -44,6 +44,10 @@ if !exists("g:syntastic_check_on_wq") let g:syntastic_check_on_wq = 1 endif +if !exists("g:syntastic_aggregate_errors") + let g:syntastic_aggregate_errors = 0 +endif + if !exists("g:syntastic_loc_list_height") let g:syntastic_loc_list_height = 10 endif @@ -176,6 +180,7 @@ function! s:CacheErrors(...) let checkers = s:registry.getActiveCheckers(ft) endif + let names = [] for checker in checkers let active_checkers += 1 call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) @@ -184,14 +189,26 @@ function! s:CacheErrors(...) if !loclist.isEmpty() let newLoclist = newLoclist.extend(loclist) - call newLoclist.setName( checker.getName() . ' ('. checker.getFiletype() . ')' ) + call add(names, [checker.getName(), checker.getFiletype()]) - "only get errors from one checker at a time - break + if !(exists('b:syntastic_aggregate_errors') ? b:syntastic_aggregate_errors : g:syntastic_aggregate_errors) + break + endif endif endfor endfor + if !empty(names) + if len(syntastic#util#unique(map(copy(names), 'v:val[1]'))) == 1 + let name = join(map(names, 'v:val[0]'), ', ') + let type = names[0][1] + call newLoclist.setName( name . ' ('. type . ')' ) + else + " checkers from mixed types + call newLoclist.setName(join(map(names, 'v:val[1] . "/" . v:val[0]'), ', ')) + endif + endif + if !active_checkers if a:0 call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) From a4fa3234f78bbae839b271b516cc9f624d428aa2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 5 Aug 2013 12:57:14 +0300 Subject: [PATCH 3/4] Bug fix: wrong variable scope. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ec93a9f0..117e5f77 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -172,6 +172,7 @@ function! s:CacheErrors(...) if !s:SkipFile() let active_checkers = 0 + let names = [] for ft in s:CurrentFiletypes() if a:0 let checker = s:registry.getChecker(ft, a:1) @@ -180,7 +181,6 @@ function! s:CacheErrors(...) let checkers = s:registry.getActiveCheckers(ft) endif - let names = [] for checker in checkers let active_checkers += 1 call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) From 755ecfe46bbd726e91bbf37cf903c4c1d349bc7f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 7 Aug 2013 12:01:45 +0300 Subject: [PATCH 4/4] Catch up with the latest pylint contortions. --- syntax_checkers/python/pylint.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 923664d4..1cf768c0 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -14,15 +14,17 @@ function! SyntaxCheckers_python_pylint_IsAvailable() endfunction function! SyntaxCheckers_python_pylint_GetLocList() + let pylint_new = s:PylintNew() + let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylint', - \ 'args': ' -f parseable -r n -i y', + \ 'args': (pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'), \ 'filetype': 'python', \ 'subchecker': 'pylint' }) let errorformat = - \ '%A%f:%l:%m,' . - \ '%A%f:(%l):%m,' . + \ '%A%f:%l: %m,' . + \ '%A%f:(%l): %m,' . \ '%-Z%p^%.%#,' . \ '%-G%.%#' @@ -32,12 +34,18 @@ function! SyntaxCheckers_python_pylint_GetLocList() \ 'postprocess': ['sort'] }) for n in range(len(loclist)) - let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][2]) >= 0 ? 'W' : 'E' + let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][1]) >= 0 ? 'W' : 'E' + let loclist[n]['vcol'] = 0 endfor return loclist endfunction +function s:PylintNew() + let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0] + return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) +endfunction + call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pylint' })