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..117e5f77 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 @@ -168,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) @@ -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) 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 = 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' })