From ce893968080100f595a4415babb793e7c3af0c62 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 6 Oct 2014 22:15:44 +0300 Subject: [PATCH] Checker-specific logging. New debug level 32, for logging tracing checkers. New method checker.log(). Cleanup. --- doc/syntastic.txt | 3 +- plugin/syntastic.vim | 4 ++- plugin/syntastic/checker.vim | 9 ++++++ syntax_checkers/bro/bro.vim | 11 ++++++- syntax_checkers/c/checkpatch.vim | 12 ++++---- syntax_checkers/c/clang_check.vim | 4 --- syntax_checkers/c/clang_tidy.vim | 4 --- syntax_checkers/c/gcc.vim | 1 + syntax_checkers/c/pc_lint.vim | 1 + syntax_checkers/cobol/cobc.vim | 1 + syntax_checkers/coffee/coffee.vim | 11 +++++-- syntax_checkers/coffee/coffeelint.vim | 5 ++-- syntax_checkers/cpp/gcc.vim | 1 + syntax_checkers/d/dmd.vim | 1 + syntax_checkers/elixir/elixir.vim | 3 ++ syntax_checkers/eruby/ruby.vim | 1 + syntax_checkers/fortran/gfortran.vim | 1 + syntax_checkers/go/golint.vim | 4 ++- syntax_checkers/go/gotype.vim | 4 +-- syntax_checkers/go/govet.vim | 10 ++++--- syntax_checkers/haskell/ghc-mod.vim | 30 +++++++++---------- syntax_checkers/haxe/haxe.vim | 2 ++ syntax_checkers/html/jshint.vim | 10 +++++-- syntax_checkers/html/tidy.vim | 4 +-- syntax_checkers/java/checkstyle.vim | 15 +++++++--- .../javascript/closurecompiler.vim | 26 ++++++++++------ syntax_checkers/javascript/eslint.vim | 11 +++++-- syntax_checkers/javascript/jshint.vim | 3 ++ syntax_checkers/javascript/jsxhint.vim | 12 +++++--- syntax_checkers/less/lessc.vim | 1 + syntax_checkers/lua/luac.vim | 2 +- syntax_checkers/objc/gcc.vim | 1 + syntax_checkers/objcpp/gcc.vim | 1 + syntax_checkers/puppet/puppet.vim | 7 +++-- syntax_checkers/puppet/puppetlint.vim | 15 ++++++---- syntax_checkers/python/pep257.vim | 5 ++-- syntax_checkers/python/pylint.vim | 30 +++++++++++++++++-- syntax_checkers/python/python.vim | 10 +++++-- syntax_checkers/ruby/mri.vim | 1 + syntax_checkers/ruby/rubocop.vim | 11 +++++-- syntax_checkers/ruby/rubylint.vim | 5 ++-- syntax_checkers/scala/scalastyle.vim | 14 ++++++--- syntax_checkers/scss/scss_lint.vim | 12 +++++--- syntax_checkers/sh/sh.vim | 1 + syntax_checkers/slim/slimrb.vim | 5 ++-- .../spec/{lacheck.vim => rpmlint.vim} | 0 syntax_checkers/tex/chktex.vim | 13 -------- syntax_checkers/vala/valac.vim | 2 +- syntax_checkers/verilog/verilator.vim | 1 + syntax_checkers/vim/vimlint.vim | 8 +++-- syntax_checkers/xhtml/tidy.vim | 4 +-- syntax_checkers/yaml/jsyaml.vim | 5 ++-- 52 files changed, 239 insertions(+), 119 deletions(-) rename syntax_checkers/spec/{lacheck.vim => rpmlint.vim} (100%) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 8f09e818..42e7d5d7 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -554,11 +554,12 @@ Default: 0 Set this to the sum of one or more of the following flags to enable debugging: - 1 - trace checker calls + 1 - trace general workflow 2 - dump location lists 4 - trace notifiers 8 - trace autocommands 16 - dump options + 32 - trace running of specific checkers Example: > let g:syntastic_debug = 1 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1ac53973..c79099e8 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.5.0-50' +let g:syntastic_version = '3.5.0-52' lockvar g:syntastic_version " Sanity checks {{{1 @@ -136,6 +136,8 @@ let g:SyntasticDebugAutocommands = 8 lockvar g:SyntasticDebugAutocommands let g:SyntasticDebugVariables = 16 lockvar g:SyntasticDebugVariables +let g:SyntasticDebugCheckers = 32 +lockvar g:SyntasticDebugCheckers " }}}1 diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 6ee8d681..8bc5e255 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -82,6 +82,15 @@ function! g:SyntasticChecker.setWantSort(val) " {{{2 let self._sort = a:val endfunction " }}}2 +function! g:SyntasticChecker.log(msg, ...) " {{{2 + let leader = self._filetype . '/' . self._name . ': ' + if a:0 > 0 + call syntastic#log#debug(g:SyntasticDebugCheckers, leader . a:msg, a:1) + else + call syntastic#log#debug(g:SyntasticDebugCheckers, leader . a:msg) + endif +endfunction " }}}2 + function! g:SyntasticChecker.makeprgBuild(opts) " {{{2 let basename = self._filetype . '_' . self._name . '_' diff --git a/syntax_checkers/bro/bro.vim b/syntax_checkers/bro/bro.vim index 11a48fec..7a3c1672 100644 --- a/syntax_checkers/bro/bro.vim +++ b/syntax_checkers/bro/bro.vim @@ -24,7 +24,16 @@ function! SyntaxCheckers_bro_bro_GetHighlightRegex(item) endfunction function! SyntaxCheckers_bro_bro_IsAvailable() dict - return system(self.getExecEscaped() . ' --help') =~# '--parse-only' + if !executable(self.getExec()) + return 0 + endif + + if system(self.getExecEscaped() . ' --help') !~# '--parse-only' + call self.log('unknown option "--parse-only"') + return 0 + endif + + return 1 endfunction function! SyntaxCheckers_bro_bro_GetLocList() dict diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 957af2de..56a4260f 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -18,18 +18,20 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_checkpatch_IsAvailable() dict - call syntastic#log#deprecationWarn('c_checker_checkpatch_location', 'c_checkpatch_exe') + call syntastic#log#deprecationWarn('c_checker_checkpatch_location', 'c_checkpatch_exec') - if !exists('g:syntastic_c_checkpatch_exe') && !executable(self.getExec()) + if !exists('g:syntastic_c_checkpatch_exec') && !executable(self.getExec()) if executable('checkpatch') - let g:syntastic_c_checkpatch_exe = 'checkpatch' + let g:syntastic_c_checkpatch_exec = 'checkpatch' elseif executable('./scripts/checkpatch.pl') - let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch.pl', ':p') + let g:syntastic_c_checkpatch_exec = fnamemodify('./scripts/checkpatch.pl', ':p') elseif executable('./scripts/checkpatch') - let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch', ':p') + let g:syntastic_c_checkpatch_exec = fnamemodify('./scripts/checkpatch', ':p') endif endif + call self.log('exec =', self.getExec()) + return executable(self.getExec()) endfunction diff --git a/syntax_checkers/c/clang_check.vim b/syntax_checkers/c/clang_check.vim index 16fbd59b..cc973b07 100644 --- a/syntax_checkers/c/clang_check.vim +++ b/syntax_checkers/c/clang_check.vim @@ -21,10 +21,6 @@ endif let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_c_clang_check_IsAvailable() dict - return executable(self.getExec()) -endfunction - function! SyntaxCheckers_c_clang_check_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': diff --git a/syntax_checkers/c/clang_tidy.vim b/syntax_checkers/c/clang_tidy.vim index 96d2e0e6..101de812 100644 --- a/syntax_checkers/c/clang_tidy.vim +++ b/syntax_checkers/c/clang_tidy.vim @@ -21,10 +21,6 @@ endif let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_c_clang_tidy_IsAvailable() dict - return executable(self.getExec()) -endfunction - function! SyntaxCheckers_c_clang_tidy_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 4fd19847..796d7730 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -26,6 +26,7 @@ function! SyntaxCheckers_c_gcc_IsAvailable() dict if !exists('g:syntastic_c_compiler') let g:syntastic_c_compiler = executable(self.getExec()) ? self.getExec() : 'clang' endif + call self.log('g:syntastic_c_compiler =', g:syntastic_c_compiler) return executable(expand(g:syntastic_c_compiler)) endfunction diff --git a/syntax_checkers/c/pc_lint.vim b/syntax_checkers/c/pc_lint.vim index 68050298..4987457c 100644 --- a/syntax_checkers/c/pc_lint.vim +++ b/syntax_checkers/c/pc_lint.vim @@ -24,6 +24,7 @@ endif function! SyntaxCheckers_c_pc_lint_GetLocList() dict let config = findfile(g:syntastic_pc_lint_config_file, '.;') + call self.log('config =', config) " -hFs1 - show filename, add space after messages, try to make message 1 line " -width(0,0) - make sure there are no line breaks diff --git a/syntax_checkers/cobol/cobc.vim b/syntax_checkers/cobol/cobc.vim index 73f5688d..09fd7eae 100644 --- a/syntax_checkers/cobol/cobc.vim +++ b/syntax_checkers/cobol/cobc.vim @@ -27,6 +27,7 @@ function! SyntaxCheckers_cobol_cobc_IsAvailable() dict if !exists('g:syntastic_cobol_compiler') let g:syntastic_cobol_compiler = self.getExec() endif + call self.log('g:syntastic_cobol_compiler =', g:syntastic_cobol_compiler) return executable(expand(g:syntastic_cobol_compiler)) endfunction diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 543647e3..c19c047b 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -22,9 +22,14 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_coffee_coffee_IsAvailable() dict - return executable(self.getExec()) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion( - \ self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()), [1,6,2]) + if !executable(self.getExec()) + return 0 + endif + + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()) + call self.log(self.getExec() . ' version = ', ver) + + return syntastic#util#versionIsAtLeast(ver, [1, 6, 2]) endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() dict diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index 99f2fad8..17a656bd 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -20,8 +20,9 @@ set cpo&vim function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict if !exists('s:coffeelint_new') - let s:coffeelint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( - \ self.getExecEscaped() . ' --version'), [1, 4]) + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + let s:coffeelint_new = syntastic#util#versionIsAtLeast(ver, [1, 4]) endif let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') }) diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index c8d77996..669e6252 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -26,6 +26,7 @@ function! SyntaxCheckers_cpp_gcc_IsAvailable() dict if !exists('g:syntastic_cpp_compiler') let g:syntastic_cpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang++' endif + call self.log('g:syntastic_cpp_compiler =', g:syntastic_cpp_compiler) return executable(expand(g:syntastic_cpp_compiler)) endfunction diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 05e7b6a1..d751ede3 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -31,6 +31,7 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict if !exists('g:syntastic_d_compiler') let g:syntastic_d_compiler = self.getExec() endif + call self.log('g:syntastic_d_compiler =', g:syntastic_d_compiler) return executable(expand(g:syntastic_d_compiler)) endfunction diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index 3914fa9b..79052700 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -20,6 +20,9 @@ set cpo&vim " TODO: we should probably split this into separate checkers function! SyntaxCheckers_elixir_elixir_IsAvailable() dict + call self.log(g:SyntasticDebugCheckers, + \ 'executable("elixir") = ' . executable('elixir') . ', ' . + \ 'executable("mix") = ' . executable('mix')) return executable('elixir') && executable('mix') endfunction diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 3dbc3a5e..25fb71f1 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -22,6 +22,7 @@ function! SyntaxCheckers_eruby_ruby_IsAvailable() dict if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec') let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec endif + call self.log('g:syntastic_eruby_ruby_exec =', g:syntastic_eruby_ruby_exec) return executable(self.getExec()) endfunction diff --git a/syntax_checkers/fortran/gfortran.vim b/syntax_checkers/fortran/gfortran.vim index ce0d1aa0..935b6bb8 100644 --- a/syntax_checkers/fortran/gfortran.vim +++ b/syntax_checkers/fortran/gfortran.vim @@ -26,6 +26,7 @@ function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict if !exists('g:syntastic_fortran_compiler') let g:syntastic_fortran_compiler = self.getExec() endif + call self.log('g:syntastic_fortran_compiler = ', g:syntastic_fortran_compiler) return executable(expand(g:syntastic_fortran_compiler)) endfunction diff --git a/syntax_checkers/go/golint.vim b/syntax_checkers/go/golint.vim index c4107016..e517e6f5 100644 --- a/syntax_checkers/go/golint.vim +++ b/syntax_checkers/go/golint.vim @@ -21,7 +21,9 @@ set cpo&vim function! SyntaxCheckers_go_golint_GetLocList() dict let makeprg = self.makeprgBuild({}) - let errorformat = '%f:%l:%c: %m,%-G%.%#' + let errorformat = + \ '%f:%l:%c: %m,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/syntax_checkers/go/gotype.vim b/syntax_checkers/go/gotype.vim index 010766e0..6c49b997 100644 --- a/syntax_checkers/go/gotype.vim +++ b/syntax_checkers/go/gotype.vim @@ -29,13 +29,11 @@ function! SyntaxCheckers_go_gotype_GetLocList() dict " the package for the same reasons specified in go.vim ("figuring out " the import path is fickle"). - let errors = SyntasticMake({ + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'cwd': expand('%:p:h'), \ 'defaults': {'type': 'e'} }) - - return errors endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/go/govet.vim b/syntax_checkers/go/govet.vim index 080204a1..c4b7fd93 100644 --- a/syntax_checkers/go/govet.vim +++ b/syntax_checkers/go/govet.vim @@ -24,19 +24,21 @@ endfunction function! SyntaxCheckers_go_govet_GetLocList() dict let makeprg = 'go vet' - let errorformat = '%Evet: %.%\+: %f:%l:%c: %m,%W%f:%l: %m,%-G%.%#' + + let errorformat = + \ '%Evet: %.%\+: %f:%l:%c: %m,' . + \ '%W%f:%l: %m,' . + \ '%-G%.%#' " The go compiler needs to either be run with an import path as an " argument or directly from the package directory. Since figuring out " the proper import path is fickle, just cwd to the package. - let errors = SyntasticMake({ + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'cwd': expand('%:p:h'), \ 'defaults': {'type': 'w'} }) - - return errors endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 7a86ffa6..42a77eac 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -21,10 +21,22 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict + if !executable(self.getExec()) + return 0 + endif + " We need either a Vim version that can handle NULs in system() output, - " or a ghc-mod version that has the --boundary option. - let exe = self.getExec() - let s:ghc_mod_new = executable(exe) ? s:GhcModNew(exe) : -1 + " or a ghc-mod version that has the "--boundary" option. + try + let ver = filter(split(system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m^ghc-mod version''')[0] + let parsed_ver = syntastic#util#parseVersion(ver) + call self.log(self.getExec() . ' version =', parsed_ver) + let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2]) + catch /\m^Vim\%((\a\+)\)\=:E684/ + call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)") + let s:ghc_mod_new = -1 + endtry + return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new) endfunction @@ -49,18 +61,6 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict \ 'returns': [0] }) endfunction -function! s:GhcModNew(exe) - let exe = syntastic#util#shescape(a:exe) - try - let ghc_mod_version = filter(split(system(exe), '\n'), 'v:val =~# ''\m^ghc-mod version''')[0] - let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(ghc_mod_version), [2, 1, 2]) - catch /\m^Vim\%((\a\+)\)\=:E684/ - call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)") - let ret = -1 - endtry - return ret -endfunction - call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haskell', \ 'name': 'ghc_mod', diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index 90589420..3769627f 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -28,6 +28,8 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict endif let hxml = fnamemodify(hxml, ':p') + call self.log('hxml =', hxml) + if hxml != '' let makeprg = self.makeprgBuild({ \ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) }) diff --git a/syntax_checkers/html/jshint.vim b/syntax_checkers/html/jshint.vim index 8bb0a530..dc236387 100644 --- a/syntax_checkers/html/jshint.vim +++ b/syntax_checkers/html/jshint.vim @@ -19,8 +19,14 @@ set cpo&vim function! SyntaxCheckers_html_jshint_IsAvailable() dict call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec') - return executable(self.getExec()) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2,4]) + if !executable(self.getExec()) + return 0 + endif + + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + + return syntastic#util#versionIsAtLeast(ver, [2, 4]) endfunction function! SyntaxCheckers_html_jshint_GetLocList() dict diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 7dcf5223..8a178996 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -164,8 +164,8 @@ let s:empty_tags = [ lockvar! s:empty_tags function! s:IgnoreError(text) - for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors - if stridx(a:text, i) != -1 + for item in s:ignore_errors + g:syntastic_html_tidy_ignore_errors + if stridx(a:text, item) != -1 return 1 endif endfor diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index 75431610..6e059737 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -28,10 +28,17 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_java_checkstyle_IsAvailable() dict - return - \ executable(self.getExec()) && - \ filereadable(expand(g:syntastic_java_checkstyle_classpath)) && - \ filereadable(expand(g:syntastic_java_checkstyle_conf_file)) + if !executable(self.getExec()) + return 0 + endif + + let classpath = expand(g:syntastic_java_checkstyle_classpath) + let conf_file = expand(g:syntastic_java_checkstyle_conf_file) + call self.log( + \ 'filereadable(' . string(classpath) . ') = ' . filereadable(classpath) . ', ' . + \ 'filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file)) + + return filereadable(classpath) && filereadable(conf_file) endfunction function! SyntaxCheckers_java_checkstyle_GetLocList() dict diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index 5dac3abe..a4d8edd0 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -20,25 +20,33 @@ set cpo&vim function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict call syntastic#log#deprecationWarn('javascript_closure_compiler_path', 'javascript_closurecompiler_path') - return - \ executable("java") && - \ exists("g:syntastic_javascript_closurecompiler_path") && - \ filereadable(g:syntastic_javascript_closurecompiler_path) + if !executable(self.getExec()) + return 0 + endif + + let cp = get(g:, 'syntastic_javascript_closurecompiler_path', '') + call self.log('g:syntastic_javascript_closurecompiler_path =', cp) + + let jar = expand(cp) + call self.log('filereadable(' . string(jar) . ') = ' . filereadable(jar)) + + return filereadable(jar) endfunction function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args') call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list') - if exists("g:syntastic_javascript_closurecompiler_file_list") - let file_list = join(readfile(g:syntastic_javascript_closurecompiler_file_list)) + let flist = expand(get(g:, 'syntastic_javascript_closurecompiler_file_list', '')) + if filereadable(flist) + let file_list = map( readfile(flist), 'expand(v:var)' ) else - let file_list = syntastic#util#shexpand('%') + let file_list = [expand('%')] endif let makeprg = self.makeprgBuild({ - \ 'exe_after': '-jar ' . g:syntastic_javascript_closurecompiler_path, - \ 'args_after': '--js' , + \ 'exe_after': ['-jar', expand(g:syntastic_javascript_closurecompiler_path)], + \ 'args_after': '--js', \ 'fname': file_list }) let errorformat = diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim index f23eb73b..e848c4a0 100644 --- a/syntax_checkers/javascript/eslint.vim +++ b/syntax_checkers/javascript/eslint.vim @@ -18,9 +18,14 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_eslint_IsAvailable() dict - return - \ executable(self.getExec()) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [0, 1]) + if !executable(self.getExec()) + return 0 + endif + + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + + return syntastic#util#versionIsAtLeast(ver, [0, 1]) endfunction function! SyntaxCheckers_javascript_eslint_GetLocList() dict diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 69706c0a..96bba9f8 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -22,7 +22,10 @@ function! SyntaxCheckers_javascript_jshint_IsAvailable() dict if !executable(self.getExec()) return 0 endif + let s:jshint_version = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', s:jshint_version) + return syntastic#util#versionIsAtLeast(s:jshint_version, [1]) endfunction diff --git a/syntax_checkers/javascript/jsxhint.vim b/syntax_checkers/javascript/jsxhint.vim index 21ba6a04..1d249237 100644 --- a/syntax_checkers/javascript/jsxhint.vim +++ b/syntax_checkers/javascript/jsxhint.vim @@ -19,10 +19,14 @@ set cpo&vim function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict let jsxhint_version = system(self.getExecEscaped() . ' --version') - return - \ v:shell_error == 0 && - \ jsxhint_version =~# '\m^JSXHint\>' && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(jsxhint_version), [0, 4, 1]) + if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>') + return 0 + endif + + let ver = syntastic#util#parseVersion(jsxhint_version) + call self.log(self.getExec() . ' version =', ver) + + return syntastic#util#versionIsAtLeast(ver, [0, 4, 1]) endfunction function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index ce653f51..786386ac 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -36,6 +36,7 @@ set cpo&vim let s:node_file = 'node ' . syntastic#util#shescape(expand(':p:h') . syntastic#util#Slash() . 'less-lint.js') function! SyntaxCheckers_less_lessc_IsAvailable() dict + call self.log('g:syntastic_less_use_less_lint =', g:syntastic_less_use_less_lint) return g:syntastic_less_use_less_lint ? executable('node') : executable(self.getExec()) endfunction diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index 012f1490..5805e780 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -47,7 +47,7 @@ endfunction function! SyntaxCheckers_lua_luac_GetLocList() dict let makeprg = self.makeprgBuild({ 'args_after': '-p' }) - let errorformat = 'luac: %#%f:%l: %m' + let errorformat = 'luac: %#%f:%l: %m' return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index 09c3daa2..d44eac17 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -26,6 +26,7 @@ function! SyntaxCheckers_objc_gcc_IsAvailable() dict if !exists('g:syntastic_objc_compiler') let g:syntastic_objc_compiler = executable(self.getExec()) ? self.getExec() : 'clang' endif + call self.log('g:syntastic_objc_compiler =', g:syntastic_objc_compiler) return executable(expand(g:syntastic_objc_compiler)) endfunction diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 853d6657..13ff8c1a 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -26,6 +26,7 @@ function! SyntaxCheckers_objcpp_gcc_IsAvailable() dict if !exists('g:syntastic_c_compiler') let g:syntastic_objcpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang' endif + call self.log('g:syntastic_objcpp_compiler =', g:syntastic_objcpp_compiler) return executable(expand(g:syntastic_objcpp_compiler)) endfunction diff --git a/syntax_checkers/puppet/puppet.vim b/syntax_checkers/puppet/puppet.vim index 38e896cd..dedb9544 100644 --- a/syntax_checkers/puppet/puppet.vim +++ b/syntax_checkers/puppet/puppet.vim @@ -19,9 +19,12 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_puppet_puppet_GetLocList() dict - let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()) + if !exists('s:puppet_version') + let s:puppet_version = syntastic#util#getVersion(self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()) + call self.log(self.getExec() . ' version =', s:puppet_version) + endif - if syntastic#util#versionIsAtLeast(ver, [2,7,0]) + if syntastic#util#versionIsAtLeast(s:puppet_version, [2,7,0]) let args = 'parser validate --color=false' else let args = '--color=false --parseonly' diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index ff4ba071..d9948cae 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -19,11 +19,16 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict - return - \ executable("puppet") && - \ executable(self.getExec()) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion( - \ self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()), [0,1,10]) + call self.log("executable('puppet') = " . executable('puppet') . ', ' . + \ "executable(" . string(self.getExec()) . ") = " . executable(self.getExec())) + if !executable('puppet') || !executable(self.getExec()) + return 0 + endif + + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()) + call self.log(self.getExec() . ' version =', ver) + + return syntastic#util#versionIsAtLeast(ver, [0, 1, 10]) endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index d4b16575..1872456a 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -15,8 +15,9 @@ set cpo&vim function! SyntaxCheckers_python_pep257_GetLocList() dict if !exists('s:pep257_new') - let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( - \ self.getExecEscaped() . ' --version'), [0, 3]) + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + let s:pep257_new = syntastic#util#versionIsAtLeast(ver, [0, 3]) endif let makeprg = self.makeprgBuild({}) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index d1373439..503348fe 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -16,14 +16,38 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_pylint_IsAvailable() dict - let exe = self.getExec() - let s:pylint_new = executable(exe) ? s:PylintNew(exe) : -1 + if !executable(self.getExec()) + return 0 + endif + + try + " On Windows the version is shown as "pylint-script.py 1.0.0". + " On Gentoo Linux it's "pylint-python2.7 0.28.0". + " On NixOS, that would be ".pylint-wrapped 0.26.0". + " On Arch Linux it's "pylint2 1.1.0". + " On new-ish Fedora it's "python3-pylint 1.2.0". + " Have you guys considered switching to creative writing yet? ;) + + let pylint_version = filter( split(system(self.getExecEscaped() . ' --version'), '\m, \=\|\n'), + \ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0] + let ver = syntastic#util#parseVersion(substitute(pylint_version, '\v^\S+\s+', '', '')) + + call self.log(self.getExec() . ' version =', ver) + + let s:pylint_new = syntastic#util#versionIsAtLeast(ver, [1]) + catch /\m^Vim\%((\a\+)\)\=:E684/ + call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)") + let s:pylint_new = -1 + endtry + return s:pylint_new >= 0 endfunction function! SyntaxCheckers_python_pylint_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args_after': (s:pylint_new ? '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : '-f parseable -r n -i y') }) + \ 'args_after': (s:pylint_new ? + \ '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : + \ '-f parseable -r n -i y') }) let errorformat = \ '%A%f:%l:%c:%t: %m,' . diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index 5023ee6c..3d1c0aee 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -21,8 +21,14 @@ set cpo&vim let s:compiler = expand(':p:h') . syntastic#util#Slash() . 'compile.py' function! SyntaxCheckers_python_python_IsAvailable() dict - return executable(self.getExec()) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2, 6]) + if !executable(self.getExec()) + return 0 + endif + + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + + return syntastic#util#versionIsAtLeast(ver, [2, 6]) endfunction function! SyntaxCheckers_python_python_GetLocList() dict diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index 8d179c27..b4b8d3af 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -21,6 +21,7 @@ set cpo&vim function! SyntaxCheckers_ruby_mri_IsAvailable() dict if !exists('g:syntastic_ruby_mri_exec') && exists('g:syntastic_ruby_exec') let g:syntastic_ruby_mri_exec = g:syntastic_ruby_exec + call self.log('g:syntastic_ruby_exec =', g:syntastic_ruby_exec) endif return executable(self.getExec()) endfunction diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 9177c563..baf2ad4d 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -22,9 +22,14 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_rubocop_IsAvailable() dict - return - \ executable(self.getExec()) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [0, 9, 0]) + if !executable(self.getExec()) + return 0 + endif + + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + + return syntastic#util#versionIsAtLeast(ver, [0, 9, 0]) endfunction function! SyntaxCheckers_ruby_rubocop_GetLocList() dict diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 07f0d4f0..b4839f54 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -21,8 +21,9 @@ set cpo&vim function! SyntaxCheckers_ruby_rubylint_GetLocList() dict if !exists('s:rubylint_new') - let s:rubylint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( - \ self.getExecEscaped() . ' --version'), [2]) + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + let s:rubylint_new = syntastic#util#versionIsAtLeast(ver, [2]) endif let makeprg = self.makeprgBuild({ 'args': (s:rubylint_new ? '' : 'analyze ') . '--presenter=syntastic' }) diff --git a/syntax_checkers/scala/scalastyle.vim b/syntax_checkers/scala/scalastyle.vim index 9c0a3cce..5d282692 100644 --- a/syntax_checkers/scala/scalastyle.vim +++ b/syntax_checkers/scala/scalastyle.vim @@ -27,10 +27,16 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_scala_scalastyle_IsAvailable() dict - return - \ executable(self.getExec()) && - \ filereadable(expand(g:syntastic_scala_scalastyle_jar)) && - \ filereadable(expand(g:syntastic_scala_scalastyle_config_file)) + if !executable(self.getExec()) + return 0 + endif + + let jar = expand(g:syntastic_scala_scalastyle_jar) + let conf_file = expand(g:syntastic_scala_scalastyle_config_file) + call self.log('filereadable(' . string(jar) . ') = ' . filereadable(jar) . ', ' . + \ 'filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file)) + + return filereadable(jar) && filereadable(conf_file) endfunction function! SyntaxCheckers_scala_scalastyle_GetLocList() dict diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim index fa63f19e..523e981c 100644 --- a/syntax_checkers/scss/scss_lint.vim +++ b/syntax_checkers/scss/scss_lint.vim @@ -18,10 +18,14 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_scss_scss_lint_IsAvailable() dict - return - \ executable(self.getExec()) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion( - \ self.getExecEscaped() . ' --version'), [0, 12]) + if !executable(self.getExec()) + return 0 + endif + + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + + return syntastic#util#versionIsAtLeast(ver, [0, 12]) endfunction function! SyntaxCheckers_scss_scss_lint_GetLocList() dict diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 65d84a97..95e6b48d 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -19,6 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_sh_sh_IsAvailable() dict + call self.log('shell =', s:GetShell()) return s:IsShellValid() endfunction diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 8cc2bfc0..51e641a1 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -20,8 +20,9 @@ set cpo&vim function! SyntaxCheckers_slim_slimrb_GetLocList() dict if !exists('s:slimrb_new') - let s:slimrb_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( - \ self.getExecEscaped() . ' --version 2>'. syntastic#util#DevNull()), [1, 3, 1]) + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version 2>'. syntastic#util#DevNull()) + call self.log(self.getExec() . ' version =', ver) + let s:slimrb_new = syntastic#util#versionIsAtLeast(ver, [1, 3, 1]) endif let makeprg = self.makeprgBuild({ 'args_after': '-c' }) diff --git a/syntax_checkers/spec/lacheck.vim b/syntax_checkers/spec/rpmlint.vim similarity index 100% rename from syntax_checkers/spec/lacheck.vim rename to syntax_checkers/spec/rpmlint.vim diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index 23392360..aa6ceb34 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -9,19 +9,6 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -" -" For details about ChkTeX see: -" -" http://baruch.ev-en.org/proj/chktex/ -" -" Checker options: -" -" - g:syntastic_tex_chktex_showmsgs (boolean; default: 1) -" whether to show informational messages (chktex option "-m"); -" by default informational messages are shown as warnings -" -" - g:syntastic_tex_chktex_args (string; default: empty) -" command line options to pass to chktex if exists('g:loaded_syntastic_tex_chktex_checker') finish diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index 912e298d..c2ca1138 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -63,7 +63,7 @@ function! s:GetValaVapiDirs() elseif type(g:syntastic_vala_vapi_dirs) == type([]) return copy(g:syntastic_vala_vapi_dirs) else - echoerr 'g:syntastic_vala_vapi_dirs must be either list or string: fallback to in file modules string' + echoerr 'g:syntastic_vala_vapi_dirs must be either a list, or a string: fallback to in-file modules string' endif endif diff --git a/syntax_checkers/verilog/verilator.vim b/syntax_checkers/verilog/verilator.vim index 396d72e5..afe58fca 100644 --- a/syntax_checkers/verilog/verilator.vim +++ b/syntax_checkers/verilog/verilator.vim @@ -20,6 +20,7 @@ function! SyntaxCheckers_verilog_verilator_IsAvailable() dict if !exists('g:syntastic_verilog_compiler') let g:syntastic_verilog_compiler = self.getExec() endif + call self.log('g:syntastic_verilog_compiler =', g:syntastic_verilog_compiler) return executable(expand(g:syntastic_verilog_compiler)) endfunction diff --git a/syntax_checkers/vim/vimlint.vim b/syntax_checkers/vim/vimlint.vim index 7122de1f..ddcf9273 100644 --- a/syntax_checkers/vim/vimlint.vim +++ b/syntax_checkers/vim/vimlint.vim @@ -36,9 +36,11 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item) endfunction function! SyntaxCheckers_vim_vimlint_IsAvailable() dict - return - \ globpath(&runtimepath, 'autoload/vimlparser.vim') != '' && - \ globpath(&runtimepath, 'autoload/vimlint.vim') != '' + let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim') + let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim') + call self.log("globpath(&runtimepath, 'autoload/vimlparser.vim') = " . string(vimlparser) . ', ' . + \ "globpath(&runtimepath, 'autoload/vimlint.vim') = " . string(vimlint)) + return vimlparser != '' && vimlint != '' endfunction function! SyntaxCheckers_vim_vimlint_GetLocList() dict diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index a3e2d47a..5c3e6330 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -47,8 +47,8 @@ function! s:TidyEncOptByFenc() endfunction function! s:IgnoreError(text) - for i in g:syntastic_xhtml_tidy_ignore_errors - if stridx(a:text, i) != -1 + for item in g:syntastic_xhtml_tidy_ignore_errors + if stridx(a:text, item) != -1 return 1 endif endfor diff --git a/syntax_checkers/yaml/jsyaml.vim b/syntax_checkers/yaml/jsyaml.vim index a0c6dba0..4361edc2 100644 --- a/syntax_checkers/yaml/jsyaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -23,8 +23,9 @@ set cpo&vim function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict if !exists('s:js_yaml_new') - let s:js_yaml_new = - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2]) + let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version') + call self.log(self.getExec() . ' version =', ver) + let s:js_yaml_new = syntastic#util#versionIsAtLeast(ver, [2]) endif let makeprg = self.makeprgBuild({ 'args_after': (s:js_yaml_new ? '' : '--compact') })