Checker-specific logging.

New debug level 32, for logging tracing checkers.
New method checker.log().
Cleanup.
This commit is contained in:
LCD 47 2014-10-06 22:15:44 +03:00
parent 21a25649bb
commit ce89396808
52 changed files with 239 additions and 119 deletions

View File

@ -554,11 +554,12 @@ Default: 0
Set this to the sum of one or more of the following flags to enable Set this to the sum of one or more of the following flags to enable
debugging: debugging:
1 - trace checker calls 1 - trace general workflow
2 - dump location lists 2 - dump location lists
4 - trace notifiers 4 - trace notifiers
8 - trace autocommands 8 - trace autocommands
16 - dump options 16 - dump options
32 - trace running of specific checkers
Example: > Example: >
let g:syntastic_debug = 1 let g:syntastic_debug = 1

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:syntastic_start lockvar! g:syntastic_start
endif endif
let g:syntastic_version = '3.5.0-50' let g:syntastic_version = '3.5.0-52'
lockvar g:syntastic_version lockvar g:syntastic_version
" Sanity checks {{{1 " Sanity checks {{{1
@ -136,6 +136,8 @@ let g:SyntasticDebugAutocommands = 8
lockvar g:SyntasticDebugAutocommands lockvar g:SyntasticDebugAutocommands
let g:SyntasticDebugVariables = 16 let g:SyntasticDebugVariables = 16
lockvar g:SyntasticDebugVariables lockvar g:SyntasticDebugVariables
let g:SyntasticDebugCheckers = 32
lockvar g:SyntasticDebugCheckers
" }}}1 " }}}1

View File

@ -82,6 +82,15 @@ function! g:SyntasticChecker.setWantSort(val) " {{{2
let self._sort = a:val let self._sort = a:val
endfunction " }}}2 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 function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
let basename = self._filetype . '_' . self._name . '_' let basename = self._filetype . '_' . self._name . '_'

View File

@ -24,7 +24,16 @@ function! SyntaxCheckers_bro_bro_GetHighlightRegex(item)
endfunction endfunction
function! SyntaxCheckers_bro_bro_IsAvailable() dict 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 endfunction
function! SyntaxCheckers_bro_bro_GetLocList() dict function! SyntaxCheckers_bro_bro_GetLocList() dict

View File

@ -18,18 +18,20 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_c_checkpatch_IsAvailable() dict 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') if executable('checkpatch')
let g:syntastic_c_checkpatch_exe = 'checkpatch' let g:syntastic_c_checkpatch_exec = 'checkpatch'
elseif executable('./scripts/checkpatch.pl') 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') 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
endif endif
call self.log('exec =', self.getExec())
return executable(self.getExec()) return executable(self.getExec())
endfunction endfunction

View File

@ -21,10 +21,6 @@ endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_c_clang_check_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_c_clang_check_GetLocList() dict function! SyntaxCheckers_c_clang_check_GetLocList() dict
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'post_args': \ 'post_args':

View File

@ -21,10 +21,6 @@ endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_c_clang_tidy_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_c_clang_tidy_GetLocList() dict function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'post_args': \ 'post_args':

View File

@ -26,6 +26,7 @@ function! SyntaxCheckers_c_gcc_IsAvailable() dict
if !exists('g:syntastic_c_compiler') if !exists('g:syntastic_c_compiler')
let g:syntastic_c_compiler = executable(self.getExec()) ? self.getExec() : 'clang' let g:syntastic_c_compiler = executable(self.getExec()) ? self.getExec() : 'clang'
endif endif
call self.log('g:syntastic_c_compiler =', g:syntastic_c_compiler)
return executable(expand(g:syntastic_c_compiler)) return executable(expand(g:syntastic_c_compiler))
endfunction endfunction

View File

@ -24,6 +24,7 @@ endif
function! SyntaxCheckers_c_pc_lint_GetLocList() dict function! SyntaxCheckers_c_pc_lint_GetLocList() dict
let config = findfile(g:syntastic_pc_lint_config_file, '.;') 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 " -hFs1 - show filename, add space after messages, try to make message 1 line
" -width(0,0) - make sure there are no line breaks " -width(0,0) - make sure there are no line breaks

View File

@ -27,6 +27,7 @@ function! SyntaxCheckers_cobol_cobc_IsAvailable() dict
if !exists('g:syntastic_cobol_compiler') if !exists('g:syntastic_cobol_compiler')
let g:syntastic_cobol_compiler = self.getExec() let g:syntastic_cobol_compiler = self.getExec()
endif endif
call self.log('g:syntastic_cobol_compiler =', g:syntastic_cobol_compiler)
return executable(expand(g:syntastic_cobol_compiler)) return executable(expand(g:syntastic_cobol_compiler))
endfunction endfunction

View File

@ -22,9 +22,14 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_coffee_coffee_IsAvailable() dict function! SyntaxCheckers_coffee_coffee_IsAvailable() dict
return executable(self.getExec()) && if !executable(self.getExec())
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion( return 0
\ self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()), [1,6,2]) 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 endfunction
function! SyntaxCheckers_coffee_coffee_GetLocList() dict function! SyntaxCheckers_coffee_coffee_GetLocList() dict

View File

@ -20,8 +20,9 @@ set cpo&vim
function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict
if !exists('s:coffeelint_new') if !exists('s:coffeelint_new')
let s:coffeelint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
\ self.getExecEscaped() . ' --version'), [1, 4]) call self.log(self.getExec() . ' version =', ver)
let s:coffeelint_new = syntastic#util#versionIsAtLeast(ver, [1, 4])
endif endif
let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') }) let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') })

View File

@ -26,6 +26,7 @@ function! SyntaxCheckers_cpp_gcc_IsAvailable() dict
if !exists('g:syntastic_cpp_compiler') if !exists('g:syntastic_cpp_compiler')
let g:syntastic_cpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang++' let g:syntastic_cpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang++'
endif endif
call self.log('g:syntastic_cpp_compiler =', g:syntastic_cpp_compiler)
return executable(expand(g:syntastic_cpp_compiler)) return executable(expand(g:syntastic_cpp_compiler))
endfunction endfunction

View File

@ -31,6 +31,7 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict
if !exists('g:syntastic_d_compiler') if !exists('g:syntastic_d_compiler')
let g:syntastic_d_compiler = self.getExec() let g:syntastic_d_compiler = self.getExec()
endif endif
call self.log('g:syntastic_d_compiler =', g:syntastic_d_compiler)
return executable(expand(g:syntastic_d_compiler)) return executable(expand(g:syntastic_d_compiler))
endfunction endfunction

View File

@ -20,6 +20,9 @@ set cpo&vim
" TODO: we should probably split this into separate checkers " TODO: we should probably split this into separate checkers
function! SyntaxCheckers_elixir_elixir_IsAvailable() dict function! SyntaxCheckers_elixir_elixir_IsAvailable() dict
call self.log(g:SyntasticDebugCheckers,
\ 'executable("elixir") = ' . executable('elixir') . ', ' .
\ 'executable("mix") = ' . executable('mix'))
return executable('elixir') && executable('mix') return executable('elixir') && executable('mix')
endfunction endfunction

View File

@ -22,6 +22,7 @@ function! SyntaxCheckers_eruby_ruby_IsAvailable() dict
if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec') if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec')
let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec
endif endif
call self.log('g:syntastic_eruby_ruby_exec =', g:syntastic_eruby_ruby_exec)
return executable(self.getExec()) return executable(self.getExec())
endfunction endfunction

View File

@ -26,6 +26,7 @@ function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict
if !exists('g:syntastic_fortran_compiler') if !exists('g:syntastic_fortran_compiler')
let g:syntastic_fortran_compiler = self.getExec() let g:syntastic_fortran_compiler = self.getExec()
endif endif
call self.log('g:syntastic_fortran_compiler = ', g:syntastic_fortran_compiler)
return executable(expand(g:syntastic_fortran_compiler)) return executable(expand(g:syntastic_fortran_compiler))
endfunction endfunction

View File

@ -21,7 +21,9 @@ set cpo&vim
function! SyntaxCheckers_go_golint_GetLocList() dict function! SyntaxCheckers_go_golint_GetLocList() dict
let makeprg = self.makeprgBuild({}) let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l:%c: %m,%-G%.%#' let errorformat =
\ '%f:%l:%c: %m,' .
\ '%-G%.%#'
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,

View File

@ -29,13 +29,11 @@ function! SyntaxCheckers_go_gotype_GetLocList() dict
" the package for the same reasons specified in go.vim ("figuring out " the package for the same reasons specified in go.vim ("figuring out
" the import path is fickle"). " the import path is fickle").
let errors = SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h'), \ 'cwd': expand('%:p:h'),
\ 'defaults': {'type': 'e'} }) \ 'defaults': {'type': 'e'} })
return errors
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -24,19 +24,21 @@ endfunction
function! SyntaxCheckers_go_govet_GetLocList() dict function! SyntaxCheckers_go_govet_GetLocList() dict
let makeprg = 'go vet' 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 " The go compiler needs to either be run with an import path as an
" argument or directly from the package directory. Since figuring out " argument or directly from the package directory. Since figuring out
" the proper import path is fickle, just cwd to the package. " the proper import path is fickle, just cwd to the package.
let errors = SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h'), \ 'cwd': expand('%:p:h'),
\ 'defaults': {'type': 'w'} }) \ 'defaults': {'type': 'w'} })
return errors
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -21,10 +21,22 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict 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, " We need either a Vim version that can handle NULs in system() output,
" or a ghc-mod version that has the --boundary option. " or a ghc-mod version that has the "--boundary" option.
let exe = self.getExec() try
let s:ghc_mod_new = executable(exe) ? s:GhcModNew(exe) : -1 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) return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new)
endfunction endfunction
@ -49,18 +61,6 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
\ 'returns': [0] }) \ 'returns': [0] })
endfunction 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({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haskell', \ 'filetype': 'haskell',
\ 'name': 'ghc_mod', \ 'name': 'ghc_mod',

View File

@ -28,6 +28,8 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
endif endif
let hxml = fnamemodify(hxml, ':p') let hxml = fnamemodify(hxml, ':p')
call self.log('hxml =', hxml)
if hxml != '' if hxml != ''
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) }) \ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) })

View File

@ -19,8 +19,14 @@ set cpo&vim
function! SyntaxCheckers_html_jshint_IsAvailable() dict function! SyntaxCheckers_html_jshint_IsAvailable() dict
call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec') call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec')
return executable(self.getExec()) && if !executable(self.getExec())
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2,4]) 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 endfunction
function! SyntaxCheckers_html_jshint_GetLocList() dict function! SyntaxCheckers_html_jshint_GetLocList() dict

View File

@ -164,8 +164,8 @@ let s:empty_tags = [
lockvar! s:empty_tags lockvar! s:empty_tags
function! s:IgnoreError(text) function! s:IgnoreError(text)
for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors for item in s:ignore_errors + g:syntastic_html_tidy_ignore_errors
if stridx(a:text, i) != -1 if stridx(a:text, item) != -1
return 1 return 1
endif endif
endfor endfor

View File

@ -28,10 +28,17 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_java_checkstyle_IsAvailable() dict function! SyntaxCheckers_java_checkstyle_IsAvailable() dict
return if !executable(self.getExec())
\ executable(self.getExec()) && return 0
\ filereadable(expand(g:syntastic_java_checkstyle_classpath)) && endif
\ filereadable(expand(g:syntastic_java_checkstyle_conf_file))
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 endfunction
function! SyntaxCheckers_java_checkstyle_GetLocList() dict function! SyntaxCheckers_java_checkstyle_GetLocList() dict

View File

@ -20,25 +20,33 @@ set cpo&vim
function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict
call syntastic#log#deprecationWarn('javascript_closure_compiler_path', 'javascript_closurecompiler_path') call syntastic#log#deprecationWarn('javascript_closure_compiler_path', 'javascript_closurecompiler_path')
return if !executable(self.getExec())
\ executable("java") && return 0
\ exists("g:syntastic_javascript_closurecompiler_path") && endif
\ filereadable(g:syntastic_javascript_closurecompiler_path)
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 endfunction
function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict
call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args') call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args')
call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list') call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list')
if exists("g:syntastic_javascript_closurecompiler_file_list") let flist = expand(get(g:, 'syntastic_javascript_closurecompiler_file_list', ''))
let file_list = join(readfile(g:syntastic_javascript_closurecompiler_file_list)) if filereadable(flist)
let file_list = map( readfile(flist), 'expand(v:var)' )
else else
let file_list = syntastic#util#shexpand('%') let file_list = [expand('%')]
endif endif
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'exe_after': '-jar ' . g:syntastic_javascript_closurecompiler_path, \ 'exe_after': ['-jar', expand(g:syntastic_javascript_closurecompiler_path)],
\ 'args_after': '--js' , \ 'args_after': '--js',
\ 'fname': file_list }) \ 'fname': file_list })
let errorformat = let errorformat =

View File

@ -18,9 +18,14 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_javascript_eslint_IsAvailable() dict function! SyntaxCheckers_javascript_eslint_IsAvailable() dict
return if !executable(self.getExec())
\ executable(self.getExec()) && return 0
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [0, 1]) endif
let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
call self.log(self.getExec() . ' version =', ver)
return syntastic#util#versionIsAtLeast(ver, [0, 1])
endfunction endfunction
function! SyntaxCheckers_javascript_eslint_GetLocList() dict function! SyntaxCheckers_javascript_eslint_GetLocList() dict

View File

@ -22,7 +22,10 @@ function! SyntaxCheckers_javascript_jshint_IsAvailable() dict
if !executable(self.getExec()) if !executable(self.getExec())
return 0 return 0
endif endif
let s:jshint_version = syntastic#util#getVersion(self.getExecEscaped() . ' --version') 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]) return syntastic#util#versionIsAtLeast(s:jshint_version, [1])
endfunction endfunction

View File

@ -19,10 +19,14 @@ set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
let jsxhint_version = system(self.getExecEscaped() . ' --version') let jsxhint_version = system(self.getExecEscaped() . ' --version')
return if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>')
\ v:shell_error == 0 && return 0
\ jsxhint_version =~# '\m^JSXHint\>' && endif
\ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(jsxhint_version), [0, 4, 1])
let ver = syntastic#util#parseVersion(jsxhint_version)
call self.log(self.getExec() . ' version =', ver)
return syntastic#util#versionIsAtLeast(ver, [0, 4, 1])
endfunction endfunction
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict

View File

@ -36,6 +36,7 @@ set cpo&vim
let s:node_file = 'node ' . syntastic#util#shescape(expand('<sfile>:p:h') . syntastic#util#Slash() . 'less-lint.js') let s:node_file = 'node ' . syntastic#util#shescape(expand('<sfile>:p:h') . syntastic#util#Slash() . 'less-lint.js')
function! SyntaxCheckers_less_lessc_IsAvailable() dict 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()) return g:syntastic_less_use_less_lint ? executable('node') : executable(self.getExec())
endfunction endfunction

View File

@ -47,7 +47,7 @@ endfunction
function! SyntaxCheckers_lua_luac_GetLocList() dict function! SyntaxCheckers_lua_luac_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-p' }) let makeprg = self.makeprgBuild({ 'args_after': '-p' })
let errorformat = 'luac: %#%f:%l: %m' let errorformat = 'luac: %#%f:%l: %m'
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,

View File

@ -26,6 +26,7 @@ function! SyntaxCheckers_objc_gcc_IsAvailable() dict
if !exists('g:syntastic_objc_compiler') if !exists('g:syntastic_objc_compiler')
let g:syntastic_objc_compiler = executable(self.getExec()) ? self.getExec() : 'clang' let g:syntastic_objc_compiler = executable(self.getExec()) ? self.getExec() : 'clang'
endif endif
call self.log('g:syntastic_objc_compiler =', g:syntastic_objc_compiler)
return executable(expand(g:syntastic_objc_compiler)) return executable(expand(g:syntastic_objc_compiler))
endfunction endfunction

View File

@ -26,6 +26,7 @@ function! SyntaxCheckers_objcpp_gcc_IsAvailable() dict
if !exists('g:syntastic_c_compiler') if !exists('g:syntastic_c_compiler')
let g:syntastic_objcpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang' let g:syntastic_objcpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang'
endif endif
call self.log('g:syntastic_objcpp_compiler =', g:syntastic_objcpp_compiler)
return executable(expand(g:syntastic_objcpp_compiler)) return executable(expand(g:syntastic_objcpp_compiler))
endfunction endfunction

View File

@ -19,9 +19,12 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_puppet_puppet_GetLocList() dict 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' let args = 'parser validate --color=false'
else else
let args = '--color=false --parseonly' let args = '--color=false --parseonly'

View File

@ -19,11 +19,16 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict
return call self.log("executable('puppet') = " . executable('puppet') . ', ' .
\ executable("puppet") && \ "executable(" . string(self.getExec()) . ") = " . executable(self.getExec()))
\ executable(self.getExec()) && if !executable('puppet') || !executable(self.getExec())
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion( return 0
\ self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()), [0,1,10]) 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 endfunction
function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict

View File

@ -15,8 +15,9 @@ set cpo&vim
function! SyntaxCheckers_python_pep257_GetLocList() dict function! SyntaxCheckers_python_pep257_GetLocList() dict
if !exists('s:pep257_new') if !exists('s:pep257_new')
let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
\ self.getExecEscaped() . ' --version'), [0, 3]) call self.log(self.getExec() . ' version =', ver)
let s:pep257_new = syntastic#util#versionIsAtLeast(ver, [0, 3])
endif endif
let makeprg = self.makeprgBuild({}) let makeprg = self.makeprgBuild({})

View File

@ -16,14 +16,38 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_python_pylint_IsAvailable() dict function! SyntaxCheckers_python_pylint_IsAvailable() dict
let exe = self.getExec() if !executable(self.getExec())
let s:pylint_new = executable(exe) ? s:PylintNew(exe) : -1 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 return s:pylint_new >= 0
endfunction endfunction
function! SyntaxCheckers_python_pylint_GetLocList() dict function! SyntaxCheckers_python_pylint_GetLocList() dict
let makeprg = self.makeprgBuild({ 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 = let errorformat =
\ '%A%f:%l:%c:%t: %m,' . \ '%A%f:%l:%c:%t: %m,' .

View File

@ -21,8 +21,14 @@ set cpo&vim
let s:compiler = expand('<sfile>:p:h') . syntastic#util#Slash() . 'compile.py' let s:compiler = expand('<sfile>:p:h') . syntastic#util#Slash() . 'compile.py'
function! SyntaxCheckers_python_python_IsAvailable() dict function! SyntaxCheckers_python_python_IsAvailable() dict
return executable(self.getExec()) && if !executable(self.getExec())
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2, 6]) 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 endfunction
function! SyntaxCheckers_python_python_GetLocList() dict function! SyntaxCheckers_python_python_GetLocList() dict

View File

@ -21,6 +21,7 @@ set cpo&vim
function! SyntaxCheckers_ruby_mri_IsAvailable() dict function! SyntaxCheckers_ruby_mri_IsAvailable() dict
if !exists('g:syntastic_ruby_mri_exec') && exists('g:syntastic_ruby_exec') if !exists('g:syntastic_ruby_mri_exec') && exists('g:syntastic_ruby_exec')
let g:syntastic_ruby_mri_exec = 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 endif
return executable(self.getExec()) return executable(self.getExec())
endfunction endfunction

View File

@ -22,9 +22,14 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_ruby_rubocop_IsAvailable() dict function! SyntaxCheckers_ruby_rubocop_IsAvailable() dict
return if !executable(self.getExec())
\ executable(self.getExec()) && return 0
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [0, 9, 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 endfunction
function! SyntaxCheckers_ruby_rubocop_GetLocList() dict function! SyntaxCheckers_ruby_rubocop_GetLocList() dict

View File

@ -21,8 +21,9 @@ set cpo&vim
function! SyntaxCheckers_ruby_rubylint_GetLocList() dict function! SyntaxCheckers_ruby_rubylint_GetLocList() dict
if !exists('s:rubylint_new') if !exists('s:rubylint_new')
let s:rubylint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
\ self.getExecEscaped() . ' --version'), [2]) call self.log(self.getExec() . ' version =', ver)
let s:rubylint_new = syntastic#util#versionIsAtLeast(ver, [2])
endif endif
let makeprg = self.makeprgBuild({ 'args': (s:rubylint_new ? '' : 'analyze ') . '--presenter=syntastic' }) let makeprg = self.makeprgBuild({ 'args': (s:rubylint_new ? '' : 'analyze ') . '--presenter=syntastic' })

View File

@ -27,10 +27,16 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_scala_scalastyle_IsAvailable() dict function! SyntaxCheckers_scala_scalastyle_IsAvailable() dict
return if !executable(self.getExec())
\ executable(self.getExec()) && return 0
\ filereadable(expand(g:syntastic_scala_scalastyle_jar)) && endif
\ filereadable(expand(g:syntastic_scala_scalastyle_config_file))
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 endfunction
function! SyntaxCheckers_scala_scalastyle_GetLocList() dict function! SyntaxCheckers_scala_scalastyle_GetLocList() dict

View File

@ -18,10 +18,14 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_scss_scss_lint_IsAvailable() dict function! SyntaxCheckers_scss_scss_lint_IsAvailable() dict
return if !executable(self.getExec())
\ executable(self.getExec()) && return 0
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion( endif
\ self.getExecEscaped() . ' --version'), [0, 12])
let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
call self.log(self.getExec() . ' version =', ver)
return syntastic#util#versionIsAtLeast(ver, [0, 12])
endfunction endfunction
function! SyntaxCheckers_scss_scss_lint_GetLocList() dict function! SyntaxCheckers_scss_scss_lint_GetLocList() dict

View File

@ -19,6 +19,7 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_sh_sh_IsAvailable() dict function! SyntaxCheckers_sh_sh_IsAvailable() dict
call self.log('shell =', s:GetShell())
return s:IsShellValid() return s:IsShellValid()
endfunction endfunction

View File

@ -20,8 +20,9 @@ set cpo&vim
function! SyntaxCheckers_slim_slimrb_GetLocList() dict function! SyntaxCheckers_slim_slimrb_GetLocList() dict
if !exists('s:slimrb_new') if !exists('s:slimrb_new')
let s:slimrb_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version 2>'. syntastic#util#DevNull())
\ self.getExecEscaped() . ' --version 2>'. syntastic#util#DevNull()), [1, 3, 1]) call self.log(self.getExec() . ' version =', ver)
let s:slimrb_new = syntastic#util#versionIsAtLeast(ver, [1, 3, 1])
endif endif
let makeprg = self.makeprgBuild({ 'args_after': '-c' }) let makeprg = self.makeprgBuild({ 'args_after': '-c' })

View File

@ -9,19 +9,6 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " 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') if exists('g:loaded_syntastic_tex_chktex_checker')
finish finish

View File

@ -63,7 +63,7 @@ function! s:GetValaVapiDirs()
elseif type(g:syntastic_vala_vapi_dirs) == type([]) elseif type(g:syntastic_vala_vapi_dirs) == type([])
return copy(g:syntastic_vala_vapi_dirs) return copy(g:syntastic_vala_vapi_dirs)
else 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
endif endif

View File

@ -20,6 +20,7 @@ function! SyntaxCheckers_verilog_verilator_IsAvailable() dict
if !exists('g:syntastic_verilog_compiler') if !exists('g:syntastic_verilog_compiler')
let g:syntastic_verilog_compiler = self.getExec() let g:syntastic_verilog_compiler = self.getExec()
endif endif
call self.log('g:syntastic_verilog_compiler =', g:syntastic_verilog_compiler)
return executable(expand(g:syntastic_verilog_compiler)) return executable(expand(g:syntastic_verilog_compiler))
endfunction endfunction

View File

@ -36,9 +36,11 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item)
endfunction endfunction
function! SyntaxCheckers_vim_vimlint_IsAvailable() dict function! SyntaxCheckers_vim_vimlint_IsAvailable() dict
return let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim')
\ globpath(&runtimepath, 'autoload/vimlparser.vim') != '' && let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim')
\ 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 endfunction
function! SyntaxCheckers_vim_vimlint_GetLocList() dict function! SyntaxCheckers_vim_vimlint_GetLocList() dict

View File

@ -47,8 +47,8 @@ function! s:TidyEncOptByFenc()
endfunction endfunction
function! s:IgnoreError(text) function! s:IgnoreError(text)
for i in g:syntastic_xhtml_tidy_ignore_errors for item in g:syntastic_xhtml_tidy_ignore_errors
if stridx(a:text, i) != -1 if stridx(a:text, item) != -1
return 1 return 1
endif endif
endfor endfor

View File

@ -23,8 +23,9 @@ set cpo&vim
function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict
if !exists('s:js_yaml_new') if !exists('s:js_yaml_new')
let s:js_yaml_new = let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2]) call self.log(self.getExec() . ' version =', ver)
let s:js_yaml_new = syntastic#util#versionIsAtLeast(ver, [2])
endif endif
let makeprg = self.makeprgBuild({ 'args_after': (s:js_yaml_new ? '' : '--compact') }) let makeprg = self.makeprgBuild({ 'args_after': (s:js_yaml_new ? '' : '--compact') })