Merge commit '3c2c5a76a0e7f9e418f2b04c9932a1fe6d208452' into main

main
Buddy Sandidge 9 years ago
commit b74a1b126a

@ -40,8 +40,8 @@ too:
Before you consider adding features to syntastic, _please_ spend a few
minutes (re-)reading the latest version of the [manual][1]. Syntastic
is changing rapidly at times, and it's quite possible that some of the
features you want to add exist already.
is changing rapidly at times, and it's quite possible that some features
you want to add exist already.
To submit a patch:
@ -54,7 +54,7 @@ Small, focused patches are preferred.
Large changes to the code should be discussed with the core team first.
Create an issue and explain your plan and see what we say.
Also make sure to update the manual whenever applicable. Nobody can use
Also, make sure to update the manual whenever applicable. Nobody can use
features that aren't documented.
<a name="generalstyle"></a>

@ -35,7 +35,7 @@
4.8. [How can I pass additional arguments to a checker?](#faqargs)
4.9. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.10. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.11. [I have enabled multiple checkers for the current filetype. How can I display all of the errors from all of the checkers together?](#faqaggregate)
4.11. [I have enabled multiple checkers for the current filetype. How can I display all errors from all checkers together?](#faqaggregate)
4.12. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext)
4.13. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete)
5. [Resources](#otherresources)
@ -53,22 +53,23 @@ are detected, the user is notified and is happy because they didn't have to
compile their code or execute their script to find them.
At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C,
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml,
Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex,
Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM,
Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG,
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, Tcl,
TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT,
Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, ASM,
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq,
CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Erlang,
eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars,
HSS, HTML, Jade, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM
intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C,
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and
iOS property lists, Puppet, Python, QML, R, Racket, Relax NG, reStructuredText,
RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX,
Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery,
YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details
about the corresponding supported checkers.
A number of third-party Vim plugins also provide checkers for syntastic,
for example: [omnisharp-vim][25], [rust.vim][12], [syntastic-extras][26],
[syntastic-more][27], [vim-crystal][29], [vim-eastwood][28], and
[vim-swift][24].
for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12],
[syntastic-extras][26], [syntastic-more][27], [vim-crystal][29],
[vim-eastwood][28], and [vim-swift][24].
Below is a screenshot showing the methods that Syntastic uses to display syntax
errors. Note that, in practise, you will only have a subset of these methods
@ -159,10 +160,10 @@ following:
## 3\. Recommended settings
Syntastic has a large number of options that can be configured, and the
defaults are not particularly well suitable for new users. It is recommended
that you start by adding the following lines to your `vimrc` file, and return
to them after reading the manual (see `:help syntastic` in Vim):
Syntastic has numerous options that can be configured, and the defaults
are not particularly well suitable for new users. It is recommended
that you start by adding the following lines to your `vimrc` file, and
return to them after reading the manual (see `:help syntastic` in Vim):
```vim
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
@ -380,7 +381,7 @@ See `:help syntastic_quiet_messages` for details.
<a name="faqaggregate"></a>
__4.11. Q. I have enabled multiple checkers for the current filetype. How can I
display all of the errors from all of the checkers together?__
display all errors from all checkers together?__
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
```vim
@ -427,7 +428,8 @@ There are also a dedicated [google group][5], and a
Syntastic aims to provide a common interface to syntax checkers for as many
languages as possible. For particular languages, there are, of course, other
plugins that provide more functionality than syntastic. You might want to take
a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
a look at [ghcmod-vim][31], [jedi-vim][7], [python-mode][8], [vim-go][32], or
[YouCompleteMe][9].
[0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png
[1]: https://github.com/tpope/vim-pathogen
@ -459,6 +461,9 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[27]: https://github.com/roktas/syntastic-more
[28]: https://github.com/venantius/vim-eastwood
[29]: https://github.com/rhysd/vim-crystal
[30]: https://github.com/the-lambda-church/merlin
[31]: https://github.com/eagletmt/ghcmod-vim
[32]: https://github.com/fatih/vim-go
<!--
vim:tw=79:sw=4:

@ -21,7 +21,7 @@ function! syntastic#c#ReadConfig(file) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
" search upwards from the current file's directory
let config = findfile(a:file, escape(expand('%:p:h', 1), ' ') . ';')
let config = syntastic#util#findFileInParent(a:file, expand('%:p:h', 1))
if config ==# ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found')
return ''
@ -223,10 +223,15 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2
" check if the user manually set some cflags
let b_cflags = s:_get_checker_var('b', a:ft, a:ck, 'cflags', '')
if b_cflags ==# ''
if a:ft ==# 'c' || a:ft ==# 'cpp'
" check whether to search for include files at all
if !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
if b_cflags !=# ''
let flags .= ' ' . b_cflags
endif
" add optional config file parameters
let config_file = s:_get_checker_var('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
if b_cflags ==# '' && (a:ft ==# 'c' || a:ft ==# 'cpp') && !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
" refresh the include file search if desired
if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0)
let flags .= ' ' . s:_search_headers()
@ -238,15 +243,6 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2
let flags .= ' ' . b:syntastic_{a:ft}_includes
endif
endif
endif
else
" user-defined cflags
let flags .= ' ' . b_cflags
endif
" add optional config file parameters
let config_file = s:_get_checker_var('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
return flags
endfunction " }}}2

@ -90,7 +90,7 @@ function! syntastic#log#debugShowOptions(level, names) abort " {{{2
let vlist = copy(type(a:names) == type('') ? [a:names] : a:names)
if !empty(vlist)
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))")
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val))) . (s:_is_modified(v:val) ? ' (!)' : '')")
echomsg leader . join(vlist, ', ')
endif
call s:_logRedirect(0)
@ -123,6 +123,21 @@ function! syntastic#log#debugDump(level) abort " {{{2
call syntastic#log#debugShowVariables( a:level, sort(keys(g:_SYNTASTIC_DEFAULTS)) )
endfunction " }}}2
function! syntastic#log#ndebug(level, title, messages) abort " {{{2
if s:_isDebugEnabled(a:level)
return
endif
call syntastic#log#error(a:title)
if type(a:messages) == type([])
for msg in a:messages
echomsg msg
endfor
else
echomsg a:messages
endif
endfunction " }}}2
" }}}1
" Private functions {{{1
@ -174,6 +189,20 @@ function! s:_format_variable(name) abort " {{{2
return join(vals, ', ')
endfunction " }}}2
function! s:_is_modified(name) abort " {{{2
if !exists('s:option_defaults')
let s:option_defaults = {}
endif
if !has_key(s:option_defaults, a:name)
let opt_save = eval('&' . a:name)
execute 'set ' . a:name . '&'
let s:option_defaults[a:name] = eval('&' . a:name)
execute 'let &' . a:name . ' = ' . string(opt_save)
endif
return s:option_defaults[a:name] !=# eval('&' . a:name)
endfunction " }}}2
" }}}1
let &cpo = s:save_cpo

@ -59,27 +59,51 @@ function! syntastic#preprocess#cppcheck(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\v^\[[^]]+\]\zs( -\> \[[^]]+\])+\ze:'', "", "")')
endfunction " }}}2
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#flow(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
let null = ''
function! syntastic#preprocess#dockerfile_lint(errors) abort " {{{2
let out = []
let json = s:_decode_JSON(join(a:errors, ''))
if type(json) == type({})
try
let data = json['error']['data'] + json['warn']['data'] + json['info']['data']
for e in data
let type = toupper(e['level'][0])
if type ==# 'I'
let type = 'W'
let style = 1
else
let style = 0
endif
let line = get(e, 'line', 1)
let message = e['message']
if has_key(e, 'description') && e['description'] !=# 'None'
let message = message . '. ' . e['description']
endif
let msg =
\ type . ':' .
\ style . ':' .
\ line . ':' .
\ message
call add(out, msg)
endfor
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
let out = []
endtry
else
call syntastic#log#warn('checker dockerfile/dockerfile_lint: unrecognized error format')
endif
return out
endfunction " }}}2
function! syntastic#preprocess#flow(errors) abort " {{{2
let idx = 0
while idx < len(a:errors) && a:errors[idx][0] != '{'
while idx < len(a:errors) && a:errors[idx][0] !=# '{'
let idx += 1
endwhile
" A hat tip to Marc Weber for this trick
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try
let errs = eval(join(a:errors[idx :], ''))
catch
let errs = {}
endtry
let errs = s:_decode_JSON(join(a:errors[idx :], ''))
let out = []
if type(errs) == type({}) && has_key(errs, 'errors') && type(errs['errors']) == type([])
@ -108,33 +132,61 @@ function! syntastic#preprocess#flow(errors) abort " {{{2
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker javascript/flow: unknown error format')
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker javascript/flow: unknown error format')
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker javascript/flow: unknown error format')
call syntastic#log#warn('checker javascript/flow: unrecognized error format')
endif
return out
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#iconv(errors) abort " {{{2
return
\ (has('iconv') || has('iconv/dyn')) && &encoding !=# '' && &encoding !=# 'utf-8' ?
\ has('iconv') && &encoding !=# '' && &encoding !=# 'utf-8' ?
\ map(a:errors, 'iconv(v:val, "utf-8", &encoding)') :
\ a:errors
endfunction " }}}2
function! syntastic#preprocess#jscs(errors) abort " {{{2
let errs = join(a:errors, '')
if errs ==# ''
return []
endif
let json = s:_decode_JSON(errs)
let out = []
if type(json) == type({})
for fname in keys(json)
if type(json[fname]) == type([])
for e in json[fname]
try
let e['message'] = substitute(e['message'], "\n", ' ', 'g')
cal add(out, fname . ':' . e['line'] . ':' . e['column'] . ':' . e['message'])
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker javascript/jscs: unrecognized error item ' . string(e))
let out = []
endtry
endfor
else
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
endif
endfor
else
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
endif
return out
endfunction " }}}2
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
return filter(copy(a:errors), 'v:val !=# ""')
endfunction " }}}2
@ -152,22 +204,8 @@ function! syntastic#preprocess#perl(errors) abort " {{{2
return syntastic#util#unique(out)
endfunction " }}}2
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#prospector(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
let null = ''
" A hat tip to Marc Weber for this trick
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try
let errs = eval(join(a:errors, ''))
catch
let errs = {}
endtry
let errs = s:_decode_JSON(join(a:errors, ''))
let out = []
if type(errs) == type({}) && has_key(errs, 'messages')
@ -189,26 +227,23 @@ function! syntastic#preprocess#prospector(errors) abort " {{{2
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker python/prospector: unknown error format')
call syntastic#log#warn('checker python/prospector: unrecognized error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker python/prospector: unknown error format')
call syntastic#log#warn('checker python/prospector: unrecognized error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker python/prospector: unknown error format')
call syntastic#log#warn('checker python/prospector: unrecognized error format')
endif
endif
return out
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#rparse(errors) abort " {{{2
let errlist = copy(a:errors)
@ -249,6 +284,79 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2
return out
endfunction " }}}2
function! syntastic#preprocess#scss_lint(errors) abort " {{{2
let errs = join(a:errors, '')
if errs ==# ''
return []
endif
let json = s:_decode_JSON(errs)
let out = []
if type(json) == type({})
for fname in keys(json)
if type(json[fname]) == type([])
for e in json[fname]
try
cal add(out, fname . ':' .
\ e['severity'][0] . ':' .
\ e['line'] . ':' .
\ e['column'] . ':' .
\ e['length'] . ':' .
\ ( has_key(e, 'linter') ? e['linter'] . ': ' : '' ) .
\ e['reason'])
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker scss/scss_lint: unrecognized error item ' . string(e))
let out = []
endtry
endfor
else
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format')
endif
endfor
else
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format')
endif
return out
endfunction " }}}2
function! syntastic#preprocess#stylelint(errors) abort " {{{2
let out = []
" CssSyntaxError: /path/to/file.css:2:11: Missed semicolon
let parts = matchlist(a:errors[0], '\v^CssSyntaxError: (.{-1,}):(\d+):(\d+): (.+)')
if len(parts) > 4
call add(out, 'E:' . join(parts[1:4], ':'))
else
let errs = s:_decode_JSON(join(a:errors, ''))
let out = []
if type(errs) == type([]) && len(errs) == 1 && type(errs[0]) == type({}) &&
\ has_key(errs[0], 'source') && has_key(errs[0], 'warnings') && type(errs[0]['warnings']) == type([])
for e in errs[0]['warnings']
try
let severity = type(e['severity']) == type(0) ? ['W', 'E'][e['severity']-1] : e['severity'][0]
let msg =
\ severity . ':' .
\ errs[0]['source'] . ':' .
\ e['line'] . ':' .
\ e['column'] . ':' .
\ e['text']
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker css/stylelint: unrecognized error item ' . string(e))
let out = []
break
endtry
endfor
else
call syntastic#log#warn('checker css/stylelint: unrecognized error format')
endif
endif
return out
endfunction " }}}2
function! syntastic#preprocess#tslint(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
endfunction " }}}2
@ -268,22 +376,8 @@ function! syntastic#preprocess#validator(errors) abort " {{{2
return out
endfunction " }}}2
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#vint(errors) abort " {{{2
" JSON artifacts
let true = 1
let false = 0
let null = ''
" A hat tip to Marc Weber for this trick
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try
let errs = eval(join(a:errors, ''))
catch
let errs = []
endtry
let errs = s:_decode_JSON(join(a:errors, ''))
let out = []
if type(errs) == type([])
@ -300,22 +394,166 @@ function! syntastic#preprocess#vint(errors) abort " {{{2
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker vim/vint: unknown error format')
call syntastic#log#warn('checker vim/vint: unrecognized error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker vim/vint: unknown error format')
call syntastic#log#warn('checker vim/vint: unrecognized error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker vim/vint: unknown error format')
call syntastic#log#warn('checker vim/vint: unrecognized error format')
endif
return out
endfunction " }}}2
" }}}1
" Workarounds {{{1
" In errorformat, \ or % following %f make it depend on isfname. The default
" setting of isfname is crafted to work with completion, rather than general
" filename matching. The result for syntastic is that filenames containing
" spaces (or a few other special characters) can't be matched.
"
" Fixing isfname to address this problem would depend on the set of legal
" characters for filenames on the filesystem the project's files lives on.
" Inferring the kind of filesystem a file lives on, in advance to parsing the
" file's name, is an interesting problem (think f.i. a file loaded from a VFAT
" partition, mounted on Linux). A problem syntastic is not prepared to solve.
"
" As a result, the functions below exist for the only reason to avoid using
" things like %f\, in errorformat.
"
" References:
" https://groups.google.com/forum/#!topic/vim_dev/pTKmZmouhio
" https://vimhelp.appspot.com/quickfix.txt.html#error-file-format
function! syntastic#preprocess#basex(errors) abort " {{{2
let out = []
let idx = 0
while idx < len(a:errors)
let parts = matchlist(a:errors[idx], '\v^\[\S+\] Stopped at (.+), (\d+)/(\d+):')
if len(parts) > 3
let err = parts[1] . ':' . parts[2] . ':' . parts[3] . ':'
let parts = matchlist(a:errors[idx+1], '\v^\[(.)\D+(\d+)\] (.+)')
if len(parts) > 3
let err .= (parts[1] ==? 'W' || parts[1] ==? 'E' ? parts[1] : 'E') . ':' . parts[2] . ':' . parts[3]
call add(out, err)
let idx +=1
endif
elseif a:errors[idx] =~# '\m^\['
" unparseable errors
call add(out, a:errors[idx])
endif
let idx +=1
endwhile
return out
endfunction " }}}2
function! syntastic#preprocess#bro(errors) abort " {{{2
let out = []
for e in a:errors
let parts = matchlist(e, '\v^%(fatal )?(error|warning) in (.{-1,}), line (\d+): (.+)')
if len(parts) > 4
let parts[1] = parts[1][0]
call add(out, join(parts[1:4], ':'))
endif
endfor
return out
endfunction " }}}2
function! syntastic#preprocess#coffeelint(errors) abort " {{{2
let out = []
for e in a:errors
let parts = matchlist(e, '\v^(.{-1,}),(\d+)%(,\d*)?,(error|warn),(.+)')
if len(parts) > 4
let parts[3] = parts[3][0]
call add(out, join(parts[1:4], ':'))
endif
endfor
return out
endfunction " }}}2
function! syntastic#preprocess#mypy(errors) abort " {{{2
let out = []
for e in a:errors
" new format
let parts = matchlist(e, '\v^(.{-1,}):(\d+): error: (.+)')
if len(parts) > 3
call add(out, join(parts[1:3], ':'))
continue
endif
" old format
let parts = matchlist(e, '\v^(.{-1,}), line (\d+): (.+)')
if len(parts) > 3
call add(out, join(parts[1:3], ':'))
endif
endfor
return out
endfunction " }}}2
function! syntastic#preprocess#nix(errors) abort " {{{2
let out = []
for e in a:errors
let parts = matchlist(e, '\v^(.{-1,}), at (.{-1,}):(\d+):(\d+)$')
if len(parts) > 4
call add(out, join(parts[2:4], ':') . ':' . parts[1])
continue
endif
let parts = matchlist(e, '\v^(.{-1,}) at (.{-1,}), line (\d+):')
if len(parts) > 3
call add(out, parts[2] . ':' . parts[3] . ':' . parts[1])
continue
endif
let parts = matchlist(e, '\v^error: (.{-1,}), in (.{-1,})$')
if len(parts) > 2
call add(out, parts[2] . ':' . parts[1])
endif
endfor
return out
endfunction " }}}2
" }}}1
" Private functions {{{1
" @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null)
function! s:_decode_JSON(json) abort " {{{2
if a:json ==# ''
return []
endif
" The following is inspired by https://github.com/MarcWeber/vim-addon-manager and
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
" A hat tip to Marc Weber for this trick
if substitute(a:json, '\v\"%(\\.|[^"\\])*\"|true|false|null|[+-]?\d+%(\.\d+%([Ee][+-]?\d+)?)?', '', 'g') !~# "[^,:{}[\\] \t]"
" JSON artifacts
let true = 1
let false = 0
let null = ''
try
let object = eval(a:json)
catch
" malformed JSON
let object = ''
endtry
else
let object = ''
endif
return object
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)

@ -51,7 +51,7 @@ endfunction " }}}2
function! syntastic#util#tmpdir() abort " {{{2
let tempdir = ''
if (has('unix') || has('mac')) && executable('mktemp')
if (has('unix') || has('mac')) && executable('mktemp') && !has('win32unix')
" TODO: option "-t" to mktemp(1) is not portable
let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp'
let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n")
@ -90,33 +90,22 @@ function! syntastic#util#rmrf(what) abort " {{{2
endif
if getftype(a:what) ==# 'dir'
if !exists('s:rmrf')
let s:rmrf =
\ has('unix') || has('mac') ? 'rm -rf' :
\ has('win32') || has('win64') ? 'rmdir /S /Q' :
\ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : ''
endif
if s:rmrf !=# ''
silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
else
call s:_rmrf(a:what)
endif
call s:_delete(a:what, 'rf')
else
silent! call delete(a:what)
endif
endfunction " }}}2
"search the first 5 lines of the file for a magic number and return a map
"containing the args and the executable
" Search the first 5 lines of the file for a magic number and return a map
" containing the args and the executable
"
"e.g.
" e.g.
"
"#!/usr/bin/perl -f -bar
" #!/usr/bin/perl -f -bar
"
"returns
" returns
"
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
" {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
function! syntastic#util#parseShebang() abort " {{{2
for lnum in range(1, 5)
let line = getline(lnum)
@ -183,7 +172,7 @@ function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
return width
endfunction " }}}2
"print as much of a:msg as possible without "Press Enter" prompt appearing
" Print as much of a:msg as possible without "Press Enter" prompt appearing
function! syntastic#util#wideMsg(msg) abort " {{{2
let old_ruler = &ruler
let old_showcmd = &showcmd
@ -226,11 +215,19 @@ function! syntastic#util#bufIsActive(buffer) abort " {{{2
return 0
endfunction " }}}2
" start in directory a:where and walk up the parent folders until it finds a
" file matching a:what; return path to that file; do NOT use this function if
" a:what doesn't contain wildcards, use findfile(a:what, escape(a:where, ' ') . ';')
" instead
function! syntastic#util#findInParent(what, where) abort " {{{2
" Start in directory a:where and walk up the parent folders until it finds a
" file named a:what; return path to that file
function! syntastic#util#findFileInParent(what, where) abort " {{{2
let old_suffixesadd = &suffixesadd
let &suffixesadd = ''
let file = findfile(a:what, escape(a:where, ' ') . ';')
let &suffixesadd = old_suffixesadd
return file
endfunction " }}}2
" Start in directory a:where and walk up the parent folders until it finds a
" file matching a:what; return path to that file
function! syntastic#util#findGlobInParent(what, where) abort " {{{2
let here = fnamemodify(a:where, ':p')
let root = syntastic#util#Slash()
@ -266,8 +263,9 @@ function! syntastic#util#unique(list) abort " {{{2
let seen = {}
let uniques = []
for e in a:list
if !has_key(seen, e)
let seen[e] = 1
let k = string(e)
if !has_key(seen, k)
let seen[k] = 1
call add(uniques, e)
endif
endfor
@ -295,7 +293,7 @@ function! syntastic#util#argsescape(opt) abort " {{{2
return []
endfunction " }}}2
" decode XML entities
" Decode XML entities
function! syntastic#util#decodeXMLEntities(string) abort " {{{2
let str = a:string
let str = substitute(str, '\m&lt;', '<', 'g')
@ -331,6 +329,87 @@ function! syntastic#util#stamp() abort " {{{2
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
endfunction " }}}2
let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'
let s:_wid_pool = 0
" Add unique IDs to windows
function! syntastic#util#setWids() abort " {{{2
for tab in range(1, tabpagenr('$'))
for win in range(1, tabpagewinnr(tab, '$'))
if gettabwinvar(tab, win, 'syntastic_wid') ==# ''
call settabwinvar(tab, win, 'syntastic_wid', s:_wid_base . s:_wid_pool)
let s:_wid_pool += 1
endif
endfor
endfor
endfunction " }}}2
let s:_str2float = function(exists('*str2float') ? 'str2float' : 'str2nr')
lockvar s:_str2float
function! syntastic#util#str2float(val) abort " {{{2
return s:_str2float(a:val)
endfunction " }}}2
function! syntastic#util#float2str(val) abort " {{{2
return s:_float2str(a:val)
endfunction " }}}2
" Crude printf()-like width formatter. Handles wide characters.
function! syntastic#util#wformat(format, str) abort " {{{2
if a:format ==# ''
return a:str
endif
echomsg string(a:format) . ', ' . string(a:str)
let specs = matchlist(a:format, '\v^(-?)(0?)(%([1-9]\d*))?%(\.(\d+))?$')
if len(specs) < 5
return a:str
endif
let flushleft = specs[1] ==# '-'
let lpad = specs[2] ==# '0' ? '0' : ' '
let minlen = str2nr(specs[3])
let maxlen = str2nr(specs[4])
let out = substitute(a:str, "\t", ' ', 'g')
if maxlen && s:_width(out) > maxlen
let chars = filter(split(out, '\zs\ze', 1), 'v:val !=# ""')
let out = ''
if flushleft
for c in chars
if s:_width(out . c) < maxlen
let out .= c
else
let out .= &encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '>'
break
endif
endfor
else
call reverse(chars)
for c in chars
if s:_width(c . out) < maxlen
let out = c . out
else
let out = (&encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '<') . out
break
endif
endfor
endif
endif
if minlen && s:_width(out) < minlen
if flushleft
let out .= repeat(' ', minlen - s:_width(out))
else
let out = repeat(lpad, minlen - s:_width(out)) . out
endif
endif
return out
endfunction " }}}2
" }}}1
" Private functions {{{1
@ -389,6 +468,27 @@ function! s:_translateElement(key, term) abort " {{{2
return ret
endfunction " }}}2
" @vimlint(EVL103, 1, a:flags)
function! s:_delete_dumb(what, flags) abort " {{{2
if !exists('s:rmrf')
let s:rmrf =
\ has('unix') || has('mac') ? 'rm -rf' :
\ has('win32') || has('win64') ? 'rmdir /S /Q' :
\ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : ''
endif
if s:rmrf !=# ''
silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
else
call s:_rmrf(a:what)
endif
endfunction " }}}2
" @vimlint(EVL103, 0, a:flags)
" delete(dir, 'rf') was added in Vim 7.4.1107, but it didn't become usable until 7.4.1128
let s:_delete = function(v:version > 704 || (v:version == 704 && has('patch1128')) ? 'delete' : 's:_delete_dumb')
lockvar s:_delete
function! s:_rmrf(what) abort " {{{2
if !exists('s:rmdir')
let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir'))
@ -408,6 +508,17 @@ function! s:_rmrf(what) abort " {{{2
endif
endfunction " }}}2
function! s:_float2str_smart(val) abort " {{{2
return printf('%.1f', a:val)
endfunction " }}}2
function! s:_float2str_dumb(val) abort " {{{2
return a:val
endfunction " }}}2
let s:_float2str = function(has('float') ? 's:_float2str_smart' : 's:_float2str_dumb')
lockvar s:_float2str
" }}}1
let &cpo = s:save_cpo

@ -36,6 +36,7 @@ CONTENTS *syntastic-contents*
5.2.Choosing the executable................|syntastic-config-exec|
5.3.Configuring specific checkers..........|syntastic-config-makeprg|
5.4.Sorting errors.........................|syntastic-config-sort|
5.5.Debugging..............................|syntastic-config-debug|
6.Notes........................................|syntastic-notes|
6.1.Handling of composite filetypes........|syntastic-composite|
6.2.Editing files over network.............|syntastic-netrw|
@ -46,14 +47,15 @@ CONTENTS *syntastic-contents*
7.2.Eclim..................................|syntastic-eclim|
7.3.The fish shell.........................|syntastic-fish|
7.4.The fizsh shell........................|syntastic-fizsh|
7.5.powerline..............................|syntastic-powerline|
7.6.The PowerShell shell...................|syntastic-powershell|
7.7.python-mode............................|syntastic-pymode|
7.8.vim-auto-save..........................|syntastic-vim-auto-save|
7.9.vim-go.................................|syntastic-vim-go|
7.10.vim-virtualenv........................|syntastic-vim-virtualenv|
7.11.YouCompleteMe.........................|syntastic-ycm|
7.12.The zsh shell and rvm.................|syntastic-zsh|
7.5.flagship...............................|syntastic-flagship|
7.6.powerline..............................|syntastic-powerline|
7.7.The PowerShell shell...................|syntastic-powershell|
7.8.python-mode............................|syntastic-pymode|
7.9.vim-auto-save..........................|syntastic-vim-auto-save|
7.10.vim-go................................|syntastic-vim-go|
7.11.vim-virtualenv........................|syntastic-vim-virtualenv|
7.12.YouCompleteMe.........................|syntastic-ycm|
7.13.The zsh shell and MacVim..............|syntastic-zsh|
8.About........................................|syntastic-about|
9.License......................................|syntastic-license|
@ -85,7 +87,7 @@ checker integrations, see the guide on the GitHub wiki:
1.1. Quick start *syntastic-quickstart*
Syntastic comes preconfigured with a default list of enabled checkers per
filetype. This list is kept reasonably short to prevent slowing down Vim or
|filetype|. This list is kept reasonably short to prevent slowing down Vim or
trying to use conflicting checkers.
You can see the list of checkers available for the current filetype with the
@ -109,10 +111,10 @@ these commands, or perhaps install a plugin such as Tim Pope's 'unimpaired'
------------------------------------------------------------------------------
1.2. Recommended settings *syntastic-recommended*
Syntastic has a large number of options that can be configured, and the
defaults are not particularly well suitable for new users. It is recommended
that you start by adding the following lines to your vimrc, and return to them
later as needed: >
Syntastic has numerous options that can be configured, and the defaults are
not particularly well suitable for new users. It is recommended that you start
by adding the following lines to your vimrc, and return to them later as
needed: >
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
@ -157,16 +159,21 @@ Something like this could be more useful: >
When syntax errors are detected a flag will be shown. The content of the flag
is derived from the |syntastic_stl_format| option.
Please note that these settings might conflict with other Vim plugins that
change the way statusline works. Refer to these plugins' documentation for
possible solutions. See also |syntastic-powerline| below if you're using the
"powerline" Vim plugin (https://github.com/powerline/powerline).
------------------------------------------------------------------------------
2.2. Error signs *syntastic-error-signs*
Syntastic uses the |:sign| commands to mark lines with errors and warnings in
the sign column. To enable this feature, use the |'syntastic_enable_signs'|
option.
Syntastic uses the |:sign| commands (provided that the |+signs| feature is
compiled in) to mark lines with errors and warnings in the sign column. To
enable this feature, use the |'syntastic_enable_signs'| option.
Signs are colored using the Error and Todo syntax highlight groups by default.
If you wish to customize the colors for the signs, you can use the following
groups:
Signs are colored using the Error and Todo syntax highlight groups by default
(see |group-name|). If you wish to customize the colors for the signs, you
can use the following groups:
SyntasticErrorSign - For syntax errors, links to 'error' by default
SyntasticWarningSign - For syntax warnings, links to 'todo' by default
SyntasticStyleErrorSign - For style errors, links to 'SyntasticErrorSign'
@ -193,17 +200,13 @@ Example: >
You can use the |:Errors| command to display the errors for the current buffer
in the |location-list|.
Note that when you use |:Errors| the current location list is overwritten with
Syntastic's own location list. The location list is also overwritten when
|syntastic_auto_jump| is non-zero and the cursor has to jump to an issue.
By default syntastic doesn't fill the |location-list| with the errors found by
the checkers, in order to reduce clashes with other plugins. Consequently, if
you run |:lopen| or |:lwindow| rather than |:Errors| to open the error window you
wouldn't see syntastic's list of errors. If you insist on using |:lopen| or
|:lwindow| you should either run |:SyntasticSetLoclist| after running the checks,
or set |syntastic_always_populate_loc_list| which tells syntastic to update the
|location-list| automatically.
you run |:lopen| or |:lwindow| rather than |:Errors| to open the error window
you wouldn't see syntastic's list of errors. If you insist on using |:lopen|
or |:lwindow| you should either run |:SyntasticSetLoclist| after running the
checks, or set |syntastic_always_populate_loc_list| which tells syntastic to
update the |location-list| automatically.
------------------------------------------------------------------------------
2.4. Error highlighting *syntastic-highlighting*
@ -250,7 +253,8 @@ You can selectively disable some of the errors found by checkers either
using |'syntastic_quiet_messages'|, or by specifying a list of patterns in
|'syntastic_ignore_files'|.
See also: |'syntastic_<filetype>_<checker>_quiet_messages'|.
See also: |'syntastic_<filetype>_<checker>_quiet_messages'| and
|'b:syntastic_skip_checks'|.
==============================================================================
3. Commands *syntastic-commands*
@ -272,15 +276,15 @@ for more info.
Manually cause a syntax check to be done. By default the checkers in the
|'g:syntastic_<filetype>_checkers'| or |'b:syntastic_checkers'| lists are run,
cf. |syntastic-filetype-checkers|. If |syntastic_aggregate_errors| is unset
cf. |syntastic-filetype-checkers|. If |'syntastic_aggregate_errors'| is unset
(which is the default), checking stops the first time a checker reports any
errors; if |syntastic_aggregate_errors| is set, all checkers that apply are run
in turn, and all errors found are aggregated in a single list.
errors; if |'syntastic_aggregate_errors'| is set, all checkers that apply are
run in turn, and all errors found are aggregated in a single list.
The command may be followed by a (space separated) list of checkers. In this
case |'g:syntastic_<filetype>_checkers'| and |'b:syntastic_checkers'| are
ignored, and the checkers named by the command's arguments are run instead, in
the order specified. The rules of |syntastic_aggregate_errors| still apply.
the order specified. The set by |'syntastic_aggregate_errors'| still apply.
Example: >
:SyntasticCheck flake8 pylint
@ -306,18 +310,17 @@ the location list explicitly.
==============================================================================
4. Global Options *syntastic-global-options*
*'syntastic_check_on_open'*
Default: 0
If enabled, syntastic will do syntax checks when buffers are first loaded as
well as on saving >
If this variable is enabled, syntastic in active mode will run syntax checks
when buffers are first loaded, as well as on saving: >
let g:syntastic_check_on_open = 1
<
*'syntastic_check_on_wq'*
Default: 1
Normally syntastic runs syntax checks whenever buffers are written to disk.
If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this
variable to 0. >
In active mode syntax checks are normally run whenever buffers are written to
disk, even when the writes happen just before quitting Vim. If you want to
skip checks when you issue |:wq|, |:x|, and |:ZZ|, set this variable to 0: >
let g:syntastic_check_on_wq = 0
<
*'syntastic_aggregate_errors'*
@ -331,36 +334,37 @@ time a checker finds any errors. >
*'syntastic_id_checkers'*
Default: 1
When results from multiple checkers are aggregated in a single error list
(that is either when |syntastic_aggregate_errors| is enabled, or when checking
a file with a composite filetype), it might not be immediately obvious which
checker has produced a given error message. This variable instructs syntastic
to label error messages with the names of the checkers that created them. >
(that is either when |'syntastic_aggregate_errors'| is enabled, or when
checking a file with a composite filetype), it might not be immediately
obvious which checker has produced a given error message. This variable
instructs syntastic to label error messages with the names of the checkers
that created them. >
let g:syntastic_id_checkers = 0
<
*'syntastic_sort_aggregated_errors'*
Default: 1
By default, when results from multiple checkers are aggregated in a single
error list (that is either when |syntastic_aggregate_errors| is enabled, or
when checking a file with a composite filetype), errors are grouped by file,
then sorted by line number, then grouped by type (namely errors take precedence
over warnings), then they are sorted by column number. If you want to leave
messages grouped by checker output, set this variable to 0. >
error list (that is either when |'syntastic_aggregate_errors'| is enabled,
or when checking a file with a composite filetype), errors are grouped by
file, then sorted by line number, then grouped by type (namely errors take
precedence over warnings), then they are sorted by column number. If you want
to leave messages grouped by checker output, set this variable to 0: >
let g:syntastic_sort_aggregated_errors = 0
<
*'syntastic_echo_current_error'*
Default: 1
If enabled, syntastic will echo current error to the command window. If
multiple errors are found on the same line, |syntastic_cursor_columns| is used
to decide which one is shown. >
multiple errors are found on the same line, |'syntastic_cursor_columns'| is
used to decide which one is shown. >
let g:syntastic_echo_current_error = 1
<
*'syntastic_cursor_columns'*
Default: 1
This option controls which errors are echoed to the command window if
|syntastic_echo_current_error| is set and multiple errors are found on the same
line. When the option is enabled, the first error corresponding to the current
column is show. Otherwise, the first error on the current line is echoed,
regardless of the cursor position on the current line.
|'syntastic_echo_current_error'| is set and multiple errors are found on the
same line. When the option is enabled, the first error corresponding to the
current column is shown. Otherwise, the first error on the current line is
echoed, regardless of the cursor position on the current line.
When dealing with very large lists of errors, disabling this option can speed
up navigation significantly: >
@ -401,10 +405,17 @@ errors (where possible). Highlighting can be turned off with the following >
<
*'syntastic_always_populate_loc_list'*
Default: 0
Enable this option to tell syntastic to always stick any detected errors into
the |location-list|: >
By default syntastic doesn't fill the |location-list| with the errors found
by the checkers, in order to reduce clashes with other plugins. Enable this
option to tell syntastic to always stick any detected errors into the
|location-list|: >
let g:syntastic_always_populate_loc_list = 1
<
Please note that if |'syntastic_auto_jump'| is set to a non-zero value the
location list is overwritten with Syntastic's own list when taking a jump,
regardless of the value of |'syntastic_always_populate_loc_list'|. The
location list is also overwritten when running the |:Errors| command.
*'syntastic_auto_jump'*
Default: 0
Enable this option if you want the cursor to jump to the first detected issue
@ -425,12 +436,17 @@ When set to 3 the cursor will jump to the first error detected, if any. If
all issues detected are warnings, the cursor won't jump. >
let g:syntastic_auto_jump = 3
<
Please note that in either situation taking the jump also has the side effect
of the location list being overwritten with Syntastic's own location list,
regardless of the value of |'syntastic_always_populate_loc_list'|.
*'syntastic_auto_loc_list'*
Default: 2
Use this option to tell syntastic to automatically open and/or close the
|location-list| (see |syntastic-error-window|).
When set to 0 the error window will not be opened or closed automatically. >
When set to 0 the error window will be neither opened nor closed
automatically. >
let g:syntastic_auto_loc_list = 0
<
When set to 1 the error window will be automatically opened when errors are
@ -440,6 +456,10 @@ detected, and closed when none are detected. >
When set to 2 the error window will be automatically closed when no errors are
detected, but not opened automatically. >
let g:syntastic_auto_loc_list = 2
<
When set to 3 the error window will be automatically opened when errors are
detected, but not closed automatically. >
let g:syntastic_auto_loc_list = 3
<
*'syntastic_loc_list_height'*
Default: 10
@ -451,8 +471,8 @@ opens. >
Default: []
Use this option to specify files that syntastic should never check. It's a
list of |regular-expression| patterns. The full paths of files (see |::p|) are
matched against these patterns, and the matches are case sensitive. Use |\c|
to specify case insensitive patterns. Example: >
matched against these patterns, and the matches are case-sensitive. Use |\c|
to specify case-insensitive patterns. Example: >
let g:syntastic_ignore_files = ['\m^/usr/include/', '\m\c\.h$']
<
*'syntastic_filetype_map'*
@ -461,7 +481,7 @@ Use this option to map non-standard filetypes to standard ones. Corresponding
checkers are mapped accordingly, which allows syntastic to check files with
non-standard filetypes: >
let g:syntastic_filetype_map = {
\ "latex": "tex",
\ "plaintex": "tex",
\ "gentoo-metadata": "xml" }
<
Composite filetypes can also be mapped to simple types, which disables the
@ -527,10 +547,10 @@ overriding filters, cf. |filter-overrides|).
"level" - takes one of two values, "warnings" or "errors"
"type" - can be either "syntax" or "style"
"regex" - is matched against the messages' text as a case insensitive
|regular-expression|
"file" - is matched against the filenames the messages refer to, as a
case sensitive |regular-expression|.
"regex" - each item in list is matched against the messages' text as a
case-insensitive |regular-expression|
"file" - each item in list is matched against the filenames the messages
refer to, as a case-sensitive |regular-expression|.
If a key is prefixed by an exclamation mark "!", the corresponding filter is
negated (i.e. the above example silences all messages that are NOT errors).
@ -567,10 +587,23 @@ magic flags are available to insert information:
%e - number of errors
%w - number of warnings
%t - total number of warnings and errors
%ne - filename of file containing first error
%nw - filename of file containing first warning
%N - filename of file containing first warning or error
%pe - filename with path of file containing first error
%pw - filename with path of file containing first warning
%P - filename with path of file containing first warning or error
%fe - line number of first error
%fw - line number of first warning
%F - line number of first warning or error
These flags accept width and alignment controls similar to the ones used by
|'statusline'| flags:
%-0{minwid}.{maxwid}{flag}
All fields except {flag} are optional. A single percent sign can be given as
"%%".
Several additional flags are available to hide text under certain conditions:
%E{...} - hide the text in the brackets unless there are errors
%W{...} - hide the text in the brackets unless there are warnings
@ -611,7 +644,6 @@ The above variable can be used to disable exit code checks in syntastic.
*'syntastic_shell'*
Default: Vim's 'shell'
This is the (full path to) the shell syntastic will use to run the checkers.
On UNIX and Mac OS-X this shell must accept Bourne-compatible syntax for
file "stdout" and "stderr" redirections ">file" and "2>file". Examples of
@ -623,6 +655,13 @@ operations. It must take care to initialize all environment variables needed
by the checkers you're using. Example: >
let g:syntastic_shell = "/bin/sh"
<
*'syntastic_nested_autocommands'*
Default: 0
Controls whether syntastic's autocommands |BufReadPost| and |BufWritePost|
are called from other |BufReadPost| and |BufWritePost| autocommands (see
|autocmd-nested|). This is known to trigger interoperability problems with
other plugins, so only enable it if you actually need that functionality.
*'syntastic_debug'*
Default: 0
Set this to the sum of one or more of the following flags to enable
@ -779,7 +818,26 @@ this variable, that takes precedence over it in the buffers where it is
defined.
For aggregated lists (see |syntastic-aggregating-errors|) these variables are
ignored if |syntastic_sort_aggregated_errors| is set (which is the default).
ignored if |'syntastic_sort_aggregated_errors'| is set (which is the default).
------------------------------------------------------------------------------
5.5 Debugging *syntastic-config-debug*
Syntastic can log a trace of its working to Vim's |message-history|. To verify
the command line constructed by syntastic to run a checker, set the variable
|'syntastic_debug'| to a non-zero value, run the checker, then run |:mes| to
display the messages, and look for "makeprg" in the output.
From a user's perspective, the useful values for |'syntastic_debug'| are 1, 3,
and 33:
1 - logs syntastic's workflow
3 - logs workflow, checker's output, and |location-list| manipulations
33 - logs workflow and checker-specific details (such as version checks).
Debug logs can be saved to a file; see |'syntastic_debug_file'| for details.
Setting |'syntastic_debug'| to 0 turns off logging.
==============================================================================
6. Notes *syntastic-notes*
@ -791,7 +849,7 @@ Some Vim plugins use composite filetypes, such as "django.python" or
"handlebars.html". Normally, syntastic deals with this situation by splitting
the filetype in its simple components, and calling all checkers that apply.
If this behaviour is not desirable, you can disable it by mapping the
composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: >
composite filetypes to simple ones using |'syntastic_filetype_map'|, e.g.: >
let g:syntastic_filetype_map = { "handlebars.html": "handlebars" }
<
------------------------------------------------------------------------------
@ -808,7 +866,7 @@ checkers, without any translation or conversion.
The 'shellslash' option is relevant only on Windows systems. This option
determines (among other things) the rules for quoting command lines, and there
is no easy way for syntastic to make sure its state is appropriate for your
shell. It should be turned off if your 'shell' (or |g:syntastic_shell|) is
shell. It should be turned off if your 'shell' (or |'syntastic_shell'|) is
"cmd.exe", and on for shells that expect an UNIX-like syntax, such as Cygwin's
"sh". Most checkers will stop working if 'shellslash' is set to the wrong
value.
@ -831,7 +889,7 @@ quickfix windows.
The "csh" and "tcsh" shells are mostly compatible with syntastic. However,
some checkers assume Bourne shell syntax for redirecting "stderr". For this
reason, you should point |g:syntastic_shell| to a Bourne-compatible shell,
reason, you should point |'syntastic_shell'| to a Bourne-compatible shell,
such as "zsh", "bash", "ksh", or even the original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
<
@ -853,7 +911,7 @@ details.
At the time of this writing the "fish" shell (see http://fishshell.com/)
doesn't support the standard UNIX syntax for file redirections, and thus it
can't be used together with syntastic. You can however set |g:syntastic_shell|
can't be used together with syntastic. You can however set |'syntastic_shell'|
to a more traditional shell, such as "zsh", "bash", "ksh", or even the
original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
@ -872,7 +930,17 @@ interactive features of "fizsh". Using a more traditional shell such as "zsh",
let g:syntastic_shell = "/bin/sh"
<
------------------------------------------------------------------------------
7.5. powerline *syntastic-powerline*
7.5 flagship *syntastic-flagship*
The "flagship" Vim plugin (https://github.com/tpope/vim-flagship) has its
own mechanism of showing flags on the |'statusline'|. To allow "flagship"
to manage syntastic's statusline flag add the following |autocommand| to
your vimrc, rather than explicitly adding the flag to your |'statusline'| as
described in the |syntastic-statusline-flag| section above: >
autocmd User Flags call Hoist("window", "SyntasticStatuslineFlag")
<
------------------------------------------------------------------------------
7.6. powerline *syntastic-powerline*
The "powerline" Vim plugin (https://github.com/powerline/powerline) comes
packaged with a syntastic segment. To customize this segment create a file
@ -889,7 +957,7 @@ packaged with a syntastic segment. To customize this segment create a file
}
<
------------------------------------------------------------------------------
7.6. The PowerShell shell *syntastic-powershell*
7.7. The PowerShell shell *syntastic-powershell*
At the time of this writing, syntastic is not compatible with using "Windows
PowerShell" (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
@ -898,38 +966,36 @@ Vim's 'shell' to a more traditional program, such as "cmd.exe": >
set shell=cmd.exe
<
------------------------------------------------------------------------------
7.7 python-mode *syntastic-pymode*
7.8 python-mode *syntastic-pymode*
Syntastic can be used along with the "python-mode" Vim plugin (see
https://github.com/klen/python-mode). However, they both run syntax checks by
default when you save buffers to disk, and this is probably not what you want.
To avoid both plugins opening error windows, you can either set passive mode
for python in syntastic (see |syntastic_mode_map|), or disable lint checks in
"python-mode", by setting |pymode_lint_write| to 0. E.g.: >
let g:pymode_lint_write = 0
for python in syntastic (see |'syntastic_mode_map'|), or disable lint checks in
"python-mode", by setting |pymode_lint_on_write| to 0. E.g.: >
let g:pymode_lint_on_write = 0
<
------------------------------------------------------------------------------
7.8. vim-auto-save *syntastic-vim-auto-save*
7.9. vim-auto-save *syntastic-vim-auto-save*
Syntastic can be used together with the "vim-auto-save" Vim plugin (see
https://github.com/907th/vim-auto-save). However, syntastic checks in active
mode only work with "vim-auto-save" version 0.1.7 or later.
------------------------------------------------------------------------------
7.9. vim-go *syntastic-vim-go*
The "vim-go" Vim plugin (https://github.com/fatih/vim-go) uses |quickfix|
lists, and thus doesn't conflict with syntastic (which uses |location-list|
lists). However, both "vim-go" and syntastic run syntax checks by default
when you save buffers to disk, and this can have confusing results. To
avoid both plugins opening error windows, you can either set passive
mode for go in syntastic (see |syntastic_mode_map|), or prevent "vim-go"
from showing a quickfix window when |g:go_fmt_command| fails, by setting
|g:go_fmt_fail_silently| to 1. E.g.: >
7.10. vim-go *syntastic-vim-go*
Syntastic can be used along with the "vim-go" Vim plugin (see
https://github.com/fatih/vim-go). However, both "vim-go" and syntastic run
syntax checks by default when you save buffers to disk. To avoid conflicts,
you have to either set passive mode in syntastic for the go filetype (see
|syntastic_mode_map|), or prevent "vim-go" from showing a quickfix window when
|g:go_fmt_command| fails, by setting |g:go_fmt_fail_silently| to 1. E.g.: >
let g:go_fmt_fail_silently = 1
<
------------------------------------------------------------------------------
7.10. vim-virtualenv *syntastic-vim-virtualenv*
7.11. vim-virtualenv *syntastic-vim-virtualenv*
At the time of this writing, syntastic can't run checkers installed
in Python virtual environments activated by "vim-virtualenv" (see
@ -937,26 +1003,27 @@ https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
"vim-virtualenv".
------------------------------------------------------------------------------
7.11 YouCompleteMe *syntastic-ycm*
7.12 YouCompleteMe *syntastic-ycm*
Syntastic can be used together with the "YouCompleteMe" Vim plugin (see
http://valloric.github.io/YouCompleteMe/). However, by default "YouCompleteMe"
disables syntastic's checkers for the "c", "cpp", "objc", and "objcpp"
filetypes, in order to allow its own checkers to run. If you want to use YCM's
identifier completer but still run syntastic's checkers for those filetypes you
have to set |ycm_show_diagnostics_ui| to 0. E.g.: >
have to set |g:ycm_show_diagnostics_ui| to 0. E.g.: >
let g:ycm_show_diagnostics_ui = 0
<
------------------------------------------------------------------------------
7.12 The zsh shell and rvm *syntastic-zsh*
7.13 The zsh shell and MacVim *syntastic-zsh*
If you're running MacVim together with the "zsh" shell (http://www.zsh.org/)
and "rvm" (https://rvm.io/), you need to be aware that MacVim does not source
the .zshrc file, but will source a .zshenv file. Consequently you have to
either source the "rvm" scripts from within .zshenv, or just set your shell to
"sh": >
let g:syntastic_shell = "/bin/sh"
<
you need to be aware that MacVim does not source your .zshrc file, but will
source a .zshenv file. Consequently you have to move any setup steps relevant
to the checkers you're using from .zshrc to .zshenv, otherwise your checkers
will misbehave when run by syntastic. This is particularly important for
programs such as "rvm" (https://rvm.io/) or "rbenv" (http://rbenv.org/), that
rely on setting environment variables.
==============================================================================
8. About *syntastic-about*

@ -9,7 +9,7 @@
"
"============================================================================
if exists('g:loaded_syntastic_plugin')
if exists('g:loaded_syntastic_plugin') || &compatible
finish
endif
let g:loaded_syntastic_plugin = 1
@ -19,11 +19,16 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.6.0-102'
let g:_SYNTASTIC_VERSION = '3.7.0-83'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
if v:version < 700 || (v:version == 700 && !has('patch175'))
call syntastic#log#error('need Vim version 7.0.175 or later')
finish
endif
for s:feature in [
\ 'autocmd',
\ 'eval',
@ -87,6 +92,7 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'ignore_extensions': '\c\v^([gx]?z|lzma|bz2)$',
\ 'ignore_files': [],
\ 'loc_list_height': 10,
\ 'nested_autocommands': 0,
\ 'quiet_messages': {},
\ 'reuse_loc_lists': 0,
\ 'shell': &shell,
@ -130,7 +136,7 @@ let s:_DEBUG_DUMP_OPTIONS = [
\ 'shelltemp',
\ 'shellxquote'
\ ]
if v:version > 703 || (v:version == 703 && has('patch446'))
if exists('+shellxescape')
call add(s:_DEBUG_DUMP_OPTIONS, 'shellxescape')
endif
lockvar! s:_DEBUG_DUMP_OPTIONS
@ -157,6 +163,8 @@ let s:registry = g:SyntasticRegistry.Instance()
let s:notifiers = g:SyntasticNotifiers.Instance()
let s:modemap = g:SyntasticModeMap.Instance()
let s:_quit_pre = []
" Commands {{{1
" @vimlint(EVL103, 1, a:cursorPos)
@ -184,12 +192,15 @@ endfunction " }}}2
" @vimlint(EVL103, 0, a:cmdLine)
" @vimlint(EVL103, 0, a:argLead)
command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck call SyntasticCheck(<f-args>)
command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo call SyntasticInfo(<f-args>)
command! Errors call SyntasticErrors()
command! SyntasticReset call SyntasticReset()
command! SyntasticToggleMode call SyntasticToggleMode()
command! SyntasticSetLoclist call SyntasticSetLoclist()
command! -bar -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck call SyntasticCheck(<f-args>)
command! -bar -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo call SyntasticInfo(<f-args>)
command! -bar Errors call SyntasticErrors()
command! -bar SyntasticReset call SyntasticReset()
command! -bar SyntasticToggleMode call SyntasticToggleMode()
command! -bar SyntasticSetLoclist call SyntasticSetLoclist()
command! SyntasticJavacEditClasspath runtime! syntax_checkers/java/*.vim | SyntasticJavacEditClasspath
command! SyntasticJavacEditConfig runtime! syntax_checkers/java/*.vim | SyntasticJavacEditConfig
" }}}1
@ -231,15 +242,26 @@ endfunction " }}}2
" Autocommands {{{1
augroup syntastic
autocmd BufReadPost * call s:BufReadPostHook()
autocmd BufWritePost * call s:BufWritePostHook()
autocmd!
autocmd BufEnter * call s:BufEnterHook()
augroup END
if v:version > 703 || (v:version == 703 && has('patch544'))
if g:syntastic_nested_autocommands
augroup syntastic
autocmd BufReadPost * nested call s:BufReadPostHook()
autocmd BufWritePost * nested call s:BufWritePostHook()
augroup END
else
augroup syntastic
autocmd BufReadPost * call s:BufReadPostHook()
autocmd BufWritePost * call s:BufWritePostHook()
augroup END
endif
if exists('##QuitPre')
" QuitPre was added in Vim 7.3.544
augroup syntastic
autocmd QuitPre * call s:QuitPreHook()
autocmd QuitPre * call s:QuitPreHook(expand('<amatch>', 1))
augroup END
endif
@ -276,10 +298,15 @@ function! s:BufEnterHook() abort " {{{2
endif
endfunction " }}}2
function! s:QuitPreHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: QuitPre, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
function! s:QuitPreHook(fname) abort " {{{2
let buf = bufnr(fnameescape(a:fname))
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, 'autocmd: QuitPre, buffer ' . buf . ' = ' . string(a:fname))
if !syntastic#util#var('check_on_wq')
call syntastic#util#setWids()
call add(s:_quit_pre, buf . '_' . getbufvar(buf, 'changetick') . '_' . w:syntastic_wid)
endif
if get(w:, 'syntastic_loclist_set', 0)
call SyntasticLoclistHide()
endif
@ -296,17 +323,23 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') .
\ ': ' . (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
call s:modemap.synch()
if s:_skip_file()
return
endif
call s:modemap.synch()
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
if run_checks
call s:CacheErrors(a:checker_names)
unlockvar! b:syntastic_changedtick
let b:syntastic_changedtick = b:changedtick
lockvar! b:syntastic_changedtick
else
if a:auto_invoked
return
endif
endif
let loclist = g:SyntasticLoclist.current()
@ -477,6 +510,7 @@ function! SyntasticMake(options) abort " {{{2
if has_key(a:options, 'errorformat')
let &errorformat = a:options['errorformat']
set errorformat<
endif
if has_key(a:options, 'cwd')
@ -552,6 +586,7 @@ function! SyntasticMake(options) abort " {{{2
endif
if bailout
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', err_lines)
throw 'Syntastic: checker error'
endif
@ -609,11 +644,26 @@ function! s:_ignore_file(filename) abort " {{{2
return 0
endfunction " }}}2
function! s:_is_quitting(buf) abort " {{{2
let quitting = 0
if exists('w:syntastic_wid')
let key = a:buf . '_' . getbufvar(a:buf, 'changetick') . '_' . w:syntastic_wid
let idx = index(s:_quit_pre, key)
if idx >= 0
call remove(s:_quit_pre, idx)
let quitting = 1
endif
endif
return quitting
endfunction " }}}2
" Skip running in special buffers
function! s:_skip_file() abort " {{{2
let fname = expand('%', 1)
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype !=# '') ||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) ||
let skip = s:_is_quitting(bufnr('%')) || get(b:, 'syntastic_skip_checks', 0) ||
\ (&buftype !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
\ getwinvar(0, '&previewwindow') || s:_ignore_file(fname) ||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
if skip
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '_skip_file: skipping checks')
@ -627,6 +677,9 @@ function! s:_explain_skip(filetypes) abort " {{{2
let why = []
let fname = expand('%', 1)
if s:_is_quitting(bufnr('%'))
call add(why, 'quitting buffer')
endif
if get(b:, 'syntastic_skip_checks', 0)
call add(why, 'b:syntastic_skip_checks set')
endif
@ -639,6 +692,9 @@ function! s:_explain_skip(filetypes) abort " {{{2
if getwinvar(0, '&diff')
call add(why, 'diff mode')
endif
if getwinvar(0, '&previewwindow')
call add(why, 'preview window')
endif
if s:_ignore_file(fname)
call add(why, 'filename matching g:syntastic_ignore_files')
endif

@ -19,13 +19,13 @@ endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
let auto_loc_list = syntastic#util#var('auto_loc_list')
if !a:loclist.isEmpty()
if syntastic#util#var('auto_loc_list') == 1
if auto_loc_list == 1 || auto_loc_list == 3
call a:loclist.show()
endif
else
if syntastic#util#var('auto_loc_list') > 0
if auto_loc_list == 1 || auto_loc_list == 2
"TODO: this will close the loc list window if one was opened by
"something other than syntastic
lclose

@ -7,22 +7,36 @@ let g:SyntasticChecker = {}
" Public methods {{{1
function! g:SyntasticChecker.New(args) abort " {{{2
function! g:SyntasticChecker.New(args, ...) abort " {{{2
let newObj = copy(self)
let newObj._filetype = a:args['filetype']
let newObj._name = a:args['name']
let newObj._exec = get(a:args, 'exec', newObj._name)
if has_key(a:args, 'redirect')
let [filetype, name] = split(a:args['redirect'], '/')
if a:0
" redirected checker
let newObj._exec = get(a:args, 'exec', a:1['_exec'])
let filetype = a:1['_filetype']
let name = a:1['_name']
let prefix = 'SyntaxCheckers_' . filetype . '_' . name . '_'
if exists('g:syntastic_' . filetype . '_' . name . '_sort') && !exists('g:syntastic_' . newObj._filetype . '_' . newObj._name . '_sort')
let g:syntastic_{newObj._filetype}_{newObj._name}_sort = g:syntastic_{filetype}_{name}_sort
endif
if has_key(a:args, 'enable')
let newObj._enable = a:args['enable']
elseif has_key(a:1, '_enable')
let newObj._enable = a:1['_enable']
endif
else
let newObj._exec = get(a:args, 'exec', newObj._name)
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
if has_key(a:args, 'enable')
let newObj._enable = a:args['enable']
endif
endif
let newObj._locListFunc = function(prefix . 'GetLocList')
@ -54,7 +68,7 @@ endfunction " }}}2
" getExec() or getExecEscaped(). Normally isAvailable() does that for you
" automatically, but you should keep still this in mind if you change the
" current checker workflow.
function! g:SyntasticChecker.syncExec() dict " {{{2
function! g:SyntasticChecker.syncExec() abort " {{{2
let user_exec =
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
@ -78,6 +92,26 @@ endfunction " }}}2
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
let name = self._filetype . '/' . self._name
if has_key(self, '_enable')
let status = syntastic#util#var(self._enable, -1)
if type(status) != type(0)
call syntastic#log#error('checker ' . name . ': invalid value ' . strtrans(string(status)) .
\ ' for g:syntastic_' . self._enable . '; try 0 or 1 instead')
return []
endif
if status < 0
call syntastic#log#error('checker ' . name . ': checks disabled for security reasons; ' .
\ 'set g:syntastic_' . self._enable . ' to 1 to override')
endif
if status <= 0
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' enabled but not forced')
return []
else
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' forced')
endif
endif
try
let list = self._locListFunc()
if self._exec !=# ''
@ -108,7 +142,13 @@ function! g:SyntasticChecker.getVersion(...) abort " {{{2
call self.log('getVersion: ' . string(command) . ': ' .
\ string(split(version_output, "\n", 1)) .
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') )
call self.setVersion(syntastic#util#parseVersion(version_output))
let parsed_ver = syntastic#util#parseVersion(version_output)
if len(parsed_ver)
call self.setVersion(parsed_ver)
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
endif
endif
return get(self, '_version', [])
endfunction " }}}2
@ -117,8 +157,6 @@ function! g:SyntasticChecker.setVersion(version) abort " {{{2
if len(a:version)
let self._version = copy(a:version)
call self.log(self.getExec() . ' version =', a:version)
else
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
endif
endfunction " }}}2
@ -152,6 +190,10 @@ function! g:SyntasticChecker.isAvailable() abort " {{{2
return self._available
endfunction " }}}2
function! g:SyntasticChecker.isDisabled() abort " {{{2
return has_key(self, '_enable') && syntastic#util#var(self._enable, -1) <= 0
endfunction " }}}2
function! g:SyntasticChecker.wantSort() abort " {{{2
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
endfunction " }}}2

@ -110,19 +110,21 @@ function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
"hide stuff wrapped in %B(...) unless there are both errors and warnings
let output = substitute(output, '\m\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g')
"sub in the total errors/warnings/both
let output = substitute(output, '\m\C%w', num_warnings, 'g')
let output = substitute(output, '\m\C%e', num_errors, 'g')
let output = substitute(output, '\m\C%t', num_issues, 'g')
"first error/warning line num
let output = substitute(output, '\m\C%F', num_issues ? self._rawLoclist[0]['lnum'] : '', 'g')
"first error line num
let output = substitute(output, '\m\C%fe', num_errors ? errors[0]['lnum'] : '', 'g')
"first warning line num
let output = substitute(output, '\m\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g')
let flags = {
\ '%': '%',
\ 't': num_issues,
\ 'e': num_errors,
\ 'w': num_warnings,
\ 'N': (num_issues ? fnamemodify( bufname(self._rawLoclist[0]['bufnr']), ':t') : ''),
\ 'P': (num_issues ? fnamemodify( bufname(self._rawLoclist[0]['bufnr']), ':p:~:.') : ''),
\ 'F': (num_issues ? self._rawLoclist[0]['lnum'] : ''),
\ 'ne': (num_errors ? fnamemodify( bufname(errors[0]['bufnr']), ':t') : ''),
\ 'pe': (num_errors ? fnamemodify( bufname(errors[0]['bufnr']), ':p:~:.') : ''),
\ 'fe': (num_errors ? errors[0]['lnum'] : ''),
\ 'nw': (num_warnings ? fnamemodify( bufname(warnings[0]['bufnr']), ':t') : ''),
\ 'pw': (num_warnings ? fnamemodify( bufname(warnings[0]['bufnr']), ':p:~:.') : ''),
\ 'fw': (num_warnings ? warnings[0]['lnum'] : '') }
let output = substitute(output, '\v\C\%(-?\d*%(\.\d+)?)([npf][ew]|[NPFtew%])', '\=syntastic#util#wformat(submatch(1), flags[submatch(2)])', 'g')
let self._stl_flag = output
else

@ -8,7 +8,8 @@ let g:loaded_syntastic_registry = 1
let s:_DEFAULT_CHECKERS = {
\ 'actionscript': ['mxmlc'],
\ 'ada': ['gcc'],
\ 'apiblueprint': ['snowcrash'],
\ 'ansible': ['ansible_lint'],
\ 'apiblueprint': ['drafter'],
\ 'applescript': ['osacompile'],
\ 'asciidoc': ['asciidoc'],
\ 'asm': ['gcc'],
@ -29,6 +30,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'd': ['dmd'],
\ 'dart': ['dartanalyzer'],
\ 'docbk': ['xmllint'],
\ 'dockerfile': ['dockerfile_lint'],
\ 'dustjs': ['swiffer'],
\ 'elixir': [],
\ 'erlang': ['escript'],
@ -38,10 +40,11 @@ let s:_DEFAULT_CHECKERS = {
\ 'go': ['go'],
\ 'haml': ['haml'],
\ 'handlebars': ['handlebars'],
\ 'haskell': ['ghc_mod', 'hdevtools', 'hlint'],
\ 'haskell': ['hdevtools', 'hlint'],
\ 'haxe': ['haxe'],
\ 'hss': ['hss'],
\ 'html': ['tidy'],
\ 'jade': ['jade_lint'],
\ 'java': ['javac'],
\ 'javascript': ['jshint', 'jslint'],
\ 'json': ['jsonlint', 'jsonval'],
@ -66,7 +69,9 @@ let s:_DEFAULT_CHECKERS = {
\ 'pod': ['podchecker'],
\ 'puppet': ['puppet', 'puppetlint'],
\ 'python': ['python', 'flake8', 'pylint'],
\ 'qml': ['qmllint'],
\ 'r': [],
\ 'rmd': [],
\ 'racket': ['racket'],
\ 'rnc': ['rnv'],
\ 'rst': ['rst2pseudoxml'],
@ -78,6 +83,8 @@ let s:_DEFAULT_CHECKERS = {
\ 'slim': ['slimrb'],
\ 'sml': ['smlnj'],
\ 'spec': ['rpmlint'],
\ 'sql': ['sqlint'],
\ 'stylus': ['stylint'],
\ 'tcl': ['nagelfar'],
\ 'tex': ['lacheck', 'chktex'],
\ 'texinfo': ['makeinfo'],
@ -91,6 +98,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'xhtml': ['tidy'],
\ 'xml': ['xmllint'],
\ 'xslt': ['xmllint'],
\ 'xquery': ['basex'],
\ 'yacc': ['bison'],
\ 'yaml': ['jsyaml'],
\ 'z80': ['z80syntaxchecker'],
@ -151,8 +159,21 @@ function! g:SyntasticRegistry.Instance() abort " {{{2
endfunction " }}}2
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) abort " {{{2
let checker = g:SyntasticChecker.New(a:args)
let registry = g:SyntasticRegistry.Instance()
if has_key(a:args, 'redirect')
let [ft, name] = split(a:args['redirect'], '/')
call registry._loadCheckersFor(ft)
let clone = get(registry._checkerMap[ft], name, {})
if empty(clone)
throw 'Syntastic: Checker ' . a:args['redirect'] . ' redirects to unregistered checker ' . ft . '/' . name
endif
let checker = g:SyntasticChecker.New(a:args, clone)
else
let checker = g:SyntasticChecker.New(a:args)
endif
call registry._registerChecker(checker)
endfunction " }}}2
@ -181,12 +202,18 @@ function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) abort " {{{2
\ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]]
endfunction " }}}2
" Same as getCheckers(), but keep only the checkers available. This runs the
" Same as getCheckers(), but keep only the available checkers. This runs the
" corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
endfunction " }}}2
" Same as getCheckers(), but keep only the checkers that are available and
" disabled. This runs the corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersDisabled(ftalias, hints_list) abort " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isDisabled() && v:val.isAvailable()')
endfunction " }}}2
function! g:SyntasticRegistry.getKnownFiletypes() abort " {{{2
let types = keys(s:_DEFAULT_CHECKERS)
@ -214,15 +241,18 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
if len(ft_list) != 1
let available = []
let active = []
let disabled = []
for ft in ft_list
call extend(available, map( self.getNamesOfAvailableCheckers(ft), 'ft . "/" . v:val' ))
call extend(active, map( self.getCheckersAvailable(ft, []), 'ft . "/" . v:val.getName()' ))
call extend(disabled, map( self.getCheckersDisabled(ft, []), 'ft . "/" . v:val.getName()' ))
endfor
else
let ft = ft_list[0]
let available = self.getNamesOfAvailableCheckers(ft)
let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()')
let disabled = map(self.getCheckersDisabled(ft, []), 'v:val.getName()')
endif
let cnt = len(available)
@ -235,6 +265,13 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
let cklist = cnt ? join(active) : '-'
echomsg 'Currently enabled checker' . plural . ': ' . cklist
let cnt = len(disabled)
let plural = cnt != 1 ? 's' : ''
if len(disabled)
let cklist = join(sort(disabled))
echomsg 'Checker' . plural . ' disabled for security reasons: ' . cklist
endif
" Eclim feels entitled to mess with syntastic's variables {{{3
if exists(':EclimValidate') && get(g:, 'EclimFileTypeValidate', 1)
let disabled = filter(copy(ft_list), 's:_disabled_by_eclim(v:val)')

@ -32,8 +32,8 @@ function! SyntaxCheckers_ada_gcc_GetLocList() dict
\ '%-G%f:%s:,' .
\ '%f:%l:%c: %m,' .
\ '%f:%l: %m',
\ 'main_flags': '-c -x ada -fsyntax-only',
\ 'header_flags': '-x ada',
\ 'main_flags': '-c -x ada -gnats',
\ 'header_flags': '-x ada -gnats',
\ 'header_names': '\.ads$' })
endfunction

@ -0,0 +1,52 @@
"============================================================================
"File: ansible_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Erik Zaadi <erik.zaadi at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_ansible_ansible_lint_checker')
finish
endif
let g:loaded_syntastic_ansible_ansible_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_ansible_ansible_lint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 0, 4])
endfunction
function! SyntaxCheckers_ansible_ansible_lint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-p' })
let errorformat = '%f:%l: [ANSIBLE%n] %m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': {'type': 'E'},
\ 'subtype': 'Style',
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ansible',
\ 'name': 'ansible_lint',
\ 'exec': 'ansible-lint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -1,5 +1,5 @@
"============================================================================
"File: snowcrash.vim
"File: drafter.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
@ -10,19 +10,19 @@
"
"============================================================================
if exists('g:loaded_syntastic_apiblueprint_snowcrash_checker')
if exists('g:loaded_syntastic_apiblueprint_drafter_checker')
finish
endif
let g:loaded_syntastic_apiblueprint_snowcrash_checker = 1
let g:loaded_syntastic_apiblueprint_drafter_checker = 1
if !exists('g:syntastic_apiblueprint_snowcrash_sort')
let g:syntastic_apiblueprint_snowcrash_sort = 1
if !exists('g:syntastic_apiblueprint_drafter_sort')
let g:syntastic_apiblueprint_drafter_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_apiblueprint_snowcrash_GetLocList() dict
function! SyntaxCheckers_apiblueprint_drafter_GetLocList() dict
let makeprg = self.makeprgBuild({ 'post_args': '-u -l' })
let errorformat =
@ -34,7 +34,7 @@ function! SyntaxCheckers_apiblueprint_snowcrash_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 2] })
\ 'returns': [0, 2, 3, 4] })
for e in loclist
let matches = matchlist(e['text'], '\v^(.+); line (\d+), column (\d+) - line (\d+), column (\d+)$')
@ -58,7 +58,7 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'apiblueprint',
\ 'name': 'snowcrash'})
\ 'name': 'drafter'})
let &cpo = s:save_cpo
unlet s:save_cpo

@ -22,14 +22,14 @@ function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': syntastic#c#NullOutput() })
let errorformat =
\ '%Easciidoc: %tRROR: %f: line %l: %m,' .
\ '%Easciidoc: %tRROR: %f: %m,' .
\ '%Easciidoc: FAILED: %f: line %l: %m,' .
\ '%Easciidoc: FAILED: %f: %m,' .
\ '%Wasciidoc: %tARNING: %f: line %l: %m,' .
\ '%Wasciidoc: %tARNING: %f: %m,' .
\ '%Wasciidoc: DEPRECATED: %f: line %l: %m,' .
\ '%Wasciidoc: DEPRECATED: %f: %m'
\ '%E%\w%\+: %tRROR: %f: line %l: %m,' .
\ '%E%\w%\+: %tRROR: %f: %m,' .
\ '%E%\w%\+: FAILED: %f: line %l: %m,' .
\ '%E%\w%\+: FAILED: %f: %m,' .
\ '%W%\w%\+: %tARNING: %f: line %l: %m,' .
\ '%W%\w%\+: %tARNING: %f: %m,' .
\ '%W%\w%\+: DEPRECATED: %f: line %l: %m,' .
\ '%W%\w%\+: DEPRECATED: %f: %m'
return SyntasticMake({
\ 'makeprg': makeprg,

@ -19,6 +19,10 @@ if !exists('g:syntastic_asm_compiler_options')
let g:syntastic_asm_compiler_options = ''
endif
if !exists('g:syntastic_asm_generic')
let g:syntastic_asm_generic = 0
endif
let s:save_cpo = &cpo
set cpo&vim
@ -36,14 +40,13 @@ function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l: %m',
\ 'main_flags': '-x assembler -fsyntax-only -masm=' . s:GetDialect() })
\ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect()) })
endfunction " }}}1
" Utilities {{{1
function! s:GetDialect() " {{{2
return exists('g:syntastic_asm_dialect') ? g:syntastic_asm_dialect :
\ expand('%:e', 1) ==? 'asm' ? 'intel' : 'att'
return syntastic#util#var('asm_dialect', expand('%:e', 1) ==? 'asm' ? 'intel' : 'att')
endfunction " }}}2
" }}}1

@ -40,14 +40,12 @@ function! SyntaxCheckers_bro_bro_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '--parse-only' })
"example: error in ./foo.bro, line 3: unknown identifier banana, at or near "banana"
let errorformat =
\ 'fatal %trror in %f\, line %l: %m,' .
\ '%trror in %f\, line %l: %m,' .
\ '%tarning in %f\, line %l: %m'
let errorformat = '%t:%f:%l:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
\ 'errorformat': errorformat,
\ 'preprocess': 'bro' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -43,9 +43,12 @@ function! SyntaxCheckers_c_clang_check_GetLocList() dict
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
endfunction

@ -43,9 +43,12 @@ function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
\ '%E%m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
endfunction

@ -23,7 +23,7 @@ if !exists('g:syntastic_pc_lint_config_file')
endif
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
let config = findfile(g:syntastic_pc_lint_config_file, escape(expand('%:p:h', 1), ' ') . ';')
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1))
call self.log('config =', config)
" -hFs1 - show filename, add space after messages, try to make message 1 line

@ -24,17 +24,14 @@ function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict
endif
let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') })
let errorformat =
\ '%f\,%l\,%\d%#\,%trror\,%m,' .
\ '%f\,%l\,%trror\,%m,' .
\ '%f\,%l\,%\d%#\,%tarn\,%m,' .
\ '%f\,%l\,%tarn\,%m'
let errorformat = '%f:%l:%t:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
\ 'returns': [0, 1],
\ 'preprocess': 'coffeelint' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -22,7 +22,7 @@ function! SyntaxCheckers_coq_coqtop_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-noglob -batch -load-vernac-source' })
let errorformat =
\ '%AFile \"%f\"\, line %l\, characters %c\-%.%#\:,'.
\ '%AFile "%f"\, line %l\, characters %c-%.%#\:,'.
\ '%C%m'
return SyntasticMake({

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_clang_check_checker')
endif
let g:loaded_syntastic_cpp_clang_check_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_check',

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_clang_tidy_checker')
endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'clang_tidy',

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_cppcheck_checker')
endif
let g:loaded_syntastic_cpp_cppcheck_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'cppcheck',

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_cpp_oclint_checker')
endif
let g:loaded_syntastic_cpp_oclint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'oclint',

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_cpp_pc_lint_checker')
endif
let g:loaded_syntastic_cpp_pc_lint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'pc_lint',

@ -0,0 +1,22 @@
"============================================================================
"File: mixedindentlint.vim
"Description: Mixed indentation linter for vim
"Maintainer: Payton Swick <payton@foolord.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_css_mixedindentlint_checker')
finish
endif
let g:loaded_syntastic_css_mixedindentlint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'mixedindentlint',
\ 'redirect': 'javascript/mixedindentlint'})
" vim: set et sts=4 sw=4:

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_css_phpcs_checker')
endif
let g:loaded_syntastic_css_phpcs_checker = 1
runtime! syntax_checkers/php/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'phpcs',

@ -16,8 +16,6 @@ if exists('g:loaded_syntastic_css_recess_checker')
endif
let g:loaded_syntastic_css_recess_checker = 1
runtime! syntax_checkers/less/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'recess',

@ -0,0 +1,47 @@
"============================================================================
"File: stylelint.vim
"Description: Syntax checking plugin for syntastic.vim using `stylelint`
" (https://github.com/stylelint/stylelint).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_css_stylelint_checker')
finish
endif
let g:loaded_syntastic_css_stylelint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
let s:args_after = {
\ 'css': '-f json',
\ 'scss': '-f json -s scss' }
function! SyntaxCheckers_css_stylelint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': get(s:args_after, self.getFiletype(), '') })
let errorformat = '%t:%f:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'stylelint',
\ 'returns': [0, 1, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'stylelint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_docbk_xmllint_checker')
endif
let g:loaded_syntastic_docbk_xmllint_checker = 1
runtime! syntax_checkers/xml/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'docbk',
\ 'name': 'xmllint',

@ -0,0 +1,53 @@
"============================================================================
"File: dockerfile_lint.vim
"Description: Syntax checking plugin for syntastic.vim using dockerfile-lint
" (https://github.com/projectatomic/dockerfile-lint).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_dockerfile_dockerfile_lint_checker')
finish
endif
let g:loaded_syntastic_dockerfile_dockerfile_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_dockerfile_dockerfile_lint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '-j',
\ 'fname_before': '-f' })
let errorformat = '%t:%n:%l:%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'dockerfile_lint',
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] })
for e in loclist
if e['nr']
let e['subtype'] = 'Style'
endif
call remove(e, 'nr')
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'dockerfile',
\ 'name': 'dockerfile_lint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -27,15 +27,9 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() dict
endfunction
function! SyntaxCheckers_elixir_elixir_GetLocList() dict
if !exists('g:syntastic_enable_elixir_checker') || !g:syntastic_enable_elixir_checker
call syntastic#log#error('checker elixir/elixir: checks disabled for security reasons; ' .
\ 'set g:syntastic_enable_elixir_checker to 1 to override')
return []
endif
let make_options = {}
let compile_command = 'elixir'
let mix_file = findfile('mix.exs', escape(expand('%:p:h', 1), ' ') . ';')
let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1))
if filereadable(mix_file)
let compile_command = 'mix compile'
@ -53,7 +47,8 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'elixir',
\ 'name': 'elixir'})
\ 'name': 'elixir',
\ 'enable': 'enable_elixir_checker'})
let &cpo = s:save_cpo
unlet s:save_cpo

@ -10,10 +10,17 @@ main([File]) ->
warn_unused_import,
report,
{i, Dir ++ "/include"}],
%% `rebar.config` is looked for,
%% but it is not necessarily the one in the project root.
%% I.e. it may be one deeper in the project file hierarchy.
RebarFile = rebar_file(Dir),
%% `rebar.config` might contain relative paths.
%% They are relative to the file! Not to the project root.
RebarOpts = rebar_opts(Dir ++ "/" ++ RebarFile),
code:add_patha(filename:absname("ebin")),
compile:file(File, Defs ++ RebarOpts);
%% `compile:file/2` requires the `{i, Path}` to be relative
%% to CWD - no surprise here.
compile:file(File, Defs ++ translate_paths(Dir, RebarOpts));
main(_) ->
io:format("Usage: ~s <file>~n", [escript:script_name()]),
@ -74,3 +81,15 @@ get_root(["test" | Tail], _Path) ->
lists:reverse(Tail);
get_root([_ | Tail], Path) ->
get_root(Tail, Path).
translate_paths(Dir, RebarOpts) ->
[ translate_path(Dir, Opt) || Opt <- RebarOpts ].
translate_path(Dir, {i, Path}) ->
case Path of
%% absolute
"/" ++ _ -> {i, Path};
%% relative -> make absolute taking rebar.config location into account
_ -> {i, filename:join([Dir, Path])}
end;
translate_path(_, Other) -> Other.

@ -44,8 +44,8 @@ function! SyntaxCheckers_fortran_gfortran_GetLocList() dict " {{{1
let errorformat =
\ '%-C %#,'.
\ '%-C %#%.%#,'.
\ '%A%f:%l.%c:,'.
\ '%Z%trror: %m,'.
\ '%A%f:%l%[.:]%c:,'.
\ '%Z%\m%\%%(Fatal %\)%\?%trror: %m,'.
\ '%Z%tarning: %m,'.
\ '%-G%.%#'
if !exists('g:syntastic_fortran_gfortran_sort')

@ -27,6 +27,10 @@ function! SyntaxCheckers_go_go_IsAvailable() dict
endfunction
function! SyntaxCheckers_go_go_GetLocList() dict
if !exists('s:go_new')
let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5])
endif
" Check with gofmt first, since `go build` and `go test` might not report
" syntax errors in the current file if another file with syntax error is
" compiled first.
@ -51,15 +55,15 @@ function! SyntaxCheckers_go_go_GetLocList() dict
" compiled by `go build`, therefore `go test` must be called for those.
if match(expand('%', 1), '\m_test\.go$') == -1
let cmd = 'build'
let opts = syntastic#util#var('go_go_build_args')
let opts = syntastic#util#var('go_go_build_args', s:go_new ? '-buildmode=archive' : '')
let cleanup = 0
else
let cmd = 'test -c'
let opts = syntastic#util#var('go_go_test_args')
let opts = syntastic#util#var('go_go_test_args', s:go_new ? '-buildmode=archive' : '')
let cleanup = 1
endif
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str
let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str
" The first pattern is for warnings from C compilers.
let errorformat =
@ -67,6 +71,8 @@ function! SyntaxCheckers_go_go_GetLocList() dict
\ '%E%f:%l:%c:%m,' .
\ '%E%f:%l:%m,' .
\ '%C%\s%\+%m,' .
\ '%+Ecan''t load package: %m,' .
\ '%+Einternal error: %m,' .
\ '%-G#%.%#'
" The go compiler needs to either be run with an import path as an
@ -77,6 +83,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h', 1),
\ 'env': {'GOGC': 'off'},
\ 'defaults': {'type': 'e'} })
if cleanup

@ -0,0 +1,53 @@
"============================================================================
"File: gometalinter.vim
"Description: Check go syntax using 'gometalint'
"Maintainer: Joshua Rubin <joshua@rubixconsulting.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_go_gometalinter_checker')
finish
endif
let g:loaded_syntastic_go_gometalinter_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_go_gometalinter_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': '-t',
\ 'fname': syntastic#util#shexpand('%:p:h') })
let errorformat =
\ '%f:%l:%c:%trror: %m,' .
\ '%f:%l:%c:%tarning: %m,' .
\ '%f:%l::%trror: %m,' .
\ '%f:%l::%tarning: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1] })
for e in loclist
if e['text'] =~# '\v\(%(deadcode|gocyclo|golint|defercheck|varcheck|structcheck|errcheck|dupl)\)$'
let e['subtype'] = 'Style'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'gometalinter'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -19,7 +19,9 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_go_gotype_GetLocList() dict
let makeprg = self.getExecEscaped() . ' .'
let makeprg = self.makeprgBuild({
\ 'args': (expand('%', 1) =~# '\m_test\.go$' ? '-a' : ''),
\ 'fname': '.' })
let errorformat =
\ '%f:%l:%c: %m,' .

@ -23,7 +23,7 @@ function! SyntaxCheckers_go_govet_IsAvailable() dict
endfunction
function! SyntaxCheckers_go_govet_GetLocList() dict
let makeprg = self.getExec() . ' vet'
let makeprg = self.getExecEscaped() . ' vet'
let errorformat =
\ '%Evet: %.%\+: %f:%l:%c: %m,' .

@ -30,25 +30,35 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
" know the version in order to know how to find out the version. :)
" Try "ghc-mod version".
let ver = filter(split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''')
let version_output = split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\sversion''')
if !len(ver)
" That didn't work. Try "ghc-mod" alone.
let ver = filter(split(syntastic#util#system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''')
let version_output = split(syntastic#util#system(self.getExecEscaped()), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\sversion''')
endif
let parsed_ver = len(ver) ? syntastic#util#parseVersion(ver[0]) : []
if len(ver)
if len(parsed_ver)
" Encouraged by the great success in finding out the version, now we
" need either a Vim that can handle NULs in system() output, or a
" ghc-mod that has the "--boundary" option.
let parsed_ver = syntastic#util#parseVersion(ver[0])
call self.setVersion(parsed_ver)
let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2])
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', version_output)
call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)")
let s:ghc_mod_new = -1
endif
return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new)
" ghc-mod 5.4.0 wants to run in the root directory of the project;
" syntastic can't cope with the resulting complications
"
" References:
" https://hackage.haskell.org/package/ghc-mod-5.4.0.0/changelog
let s:ghc_mod_bailout = syntastic#util#versionIsAtLeast(parsed_ver, [5, 4])
return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new) && !s:ghc_mod_bailout
endfunction
function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict

@ -18,6 +18,7 @@ function! SyntaxCheckers_haskell_hlint_GetLocList() dict
\ 'fname': syntastic#util#shexpand('%:p')})
let errorformat =
\ '%E%f:%l:%v: Error while reading hint file\, %m,' .
\ '%E%f:%l:%v: Error: %m,' .
\ '%W%f:%l:%v: Warning: %m,' .
\ '%C%m'

@ -24,7 +24,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
elseif exists('g:vaxe_hxml')
let hxml = g:vaxe_hxml
else
let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h', 1))
let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1))
endif
let hxml = fnamemodify(hxml, ':p')

@ -0,0 +1,40 @@
"============================================================================
"File: jade_lint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Ben Parnell <benjaminparnell.94@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_jade_jade_lint_checker')
finish
endif
let g:loaded_syntastic_jade_jade_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_jade_jade_lint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-r inline' })
let errorformat = '%f:%l:%c %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'jade',
\ 'name': 'jade_lint',
\ 'exec': 'jade-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -17,7 +17,7 @@ endif
let g:loaded_syntastic_java_checkstyle_checker = 1
if !exists('g:syntastic_java_checkstyle_classpath')
let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar'
let g:syntastic_java_checkstyle_classpath = 'checkstyle-6.10.1-all.jar'
endif
if !exists('g:syntastic_java_checkstyle_conf_file')
@ -32,30 +32,38 @@ function! SyntaxCheckers_java_checkstyle_IsAvailable() dict
return 0
endif
let classpath = expand(g:syntastic_java_checkstyle_classpath, 1)
let conf_file = expand(g:syntastic_java_checkstyle_conf_file, 1)
call self.log(
\ 'filereadable(' . string(classpath) . ') = ' . filereadable(classpath) . ', ' .
\ 'filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file))
call self.log('filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file))
return filereadable(classpath) && filereadable(conf_file)
return filereadable(conf_file)
endfunction
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
" classpath
if !exists('s:sep')
let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':'
endif
let classpath = join(map( split(g:syntastic_java_checkstyle_classpath, s:sep, 1), 'expand(v:val, 1)' ), s:sep)
call self.log('classpath =', classpath)
" forced options
let opts = []
if classpath !=# ''
call extend(opts, ['-cp', classpath])
endif
call extend(opts, [
\ 'com.puppycrawl.tools.checkstyle.Main',
\ '-c', expand(g:syntastic_java_checkstyle_conf_file, 1),
\ '-f', 'xml' ])
" filename
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
if has('win32unix')
let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
endif
let makeprg = self.makeprgBuild({
\ 'args_after': [
\ '-cp', expand(g:syntastic_java_checkstyle_classpath, 1),
\ 'com.puppycrawl.tools.checkstyle.Main',
\ '-c', expand(g:syntastic_java_checkstyle_conf_file, 1),
\ '-f', 'xml'],
\ 'fname': fname })
let makeprg = self.makeprgBuild({ 'args_after': opts, 'fname': fname })
let errorformat = '%f:%t:%l:%c:%m'

@ -73,11 +73,23 @@ endif
" }}}1
" Constants {{{1
let s:_FILE_SHORTCUTS = {
\ '%FILE_PATH%': '%:p',
\ '%FILE_NAME%': '%:t',
\ '%FILE_DIR%': '%:p:h',
\ }
lockvar! s:_FILE_SHORTCUTS
" }}}1
" Commands {{{1
command! SyntasticJavacEditClasspath call s:EditClasspath()
command! SyntasticJavacEditConfig call s:EditConfig()
if g:syntastic_java_javac_config_file_enabled
command! SyntasticJavacEditConfig call s:EditConfig()
endif
" }}}1
function! SyntaxCheckers_java_javac_IsAvailable() dict " {{{1
let s:has_maven = executable(expand(g:syntastic_java_maven_executable, 1))
@ -129,7 +141,12 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
" load custom classpath {{{2
if g:syntastic_java_javac_custom_classpath_command !=# ''
let lines = syntastic#util#system(g:syntastic_java_javac_custom_classpath_command)
" Pre-process the classpath command string a little.
let classpath_command = g:syntastic_java_javac_custom_classpath_command
for [key, val] in items(s:_FILE_SHORTCUTS)
let classpath_command = substitute(classpath_command, '\V' . key, syntastic#util#shexpand(val), 'g')
endfor
let lines = syntastic#util#system(classpath_command)
if syntastic#util#isRunningWindows() || has('win32unix')
let lines = substitute(lines, "\r\n", "\n", 'g')
endif
@ -157,9 +174,8 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
let errorformat =
\ '%E%f:%l: error: %m,'.
\ '%W%f:%l: warning: %m,'.
\ '%A%f:%l: %m,'.
\ '%+Z%p^,'.
\ '%+C%.%#,'.
\ '%E%f:%l: %m,'.
\ '%Z%p^,'.
\ '%-G%.%#'
if output_dir !=# ''
@ -274,6 +290,10 @@ function! s:SaveConfig() " {{{2
endfunction " }}}2
function! s:EditConfig() " {{{2
if !g:syntastic_java_javac_config_file_enabled
return
endif
let command = 'syntastic javac config'
let winnr = bufwinnr('^' . command . '$')
if winnr < 0
@ -299,7 +319,7 @@ endfunction " }}}2
function! s:GetMavenProperties() " {{{2
let mvn_properties = {}
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
@ -334,13 +354,13 @@ function! s:GetMavenProperties() " {{{2
endfunction " }}}2
function! s:GetMavenClasspath() " {{{2
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
\ ' -f ' . syntastic#util#shescape(pom) .
\ ' ' . g:syntastic_java_maven_options
let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath'), "\n")
let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath -DincludeScope=test'), "\n")
let mvn_classpath = ''
let class_path_next = 0
@ -357,16 +377,10 @@ function! s:GetMavenClasspath() " {{{2
let mvn_properties = s:GetMavenProperties()
let sep = syntastic#util#Slash()
let output_dir = join(['target', 'classes'], sep)
if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory']
endif
let output_dir = get(mvn_properties, 'project.build.outputDirectory', join(['target', 'classes'], sep))
let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir)
let test_output_dir = join(['target', 'test-classes'], sep)
if has_key(mvn_properties, 'project.build.testOutputDirectory')
let test_output_dir = mvn_properties['project.build.testOutputDirectory']
endif
let test_output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join(['target', 'test-classes'], sep))
let mvn_classpath = s:AddToClasspath(mvn_classpath, test_output_dir)
let g:syntastic_java_javac_maven_pom_ftime[pom] = getftime(pom)
@ -378,26 +392,19 @@ function! s:GetMavenClasspath() " {{{2
endfunction " }}}2
function! s:MavenOutputDirectory() " {{{2
let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
if s:has_maven && filereadable(pom)
let mvn_properties = s:GetMavenProperties()
let output_dir = getcwd()
if has_key(mvn_properties, 'project.properties.build.dir')
let output_dir = mvn_properties['project.properties.build.dir']
endif
let output_dir = get(mvn_properties, 'project.properties.build.dir', getcwd())
let sep = syntastic#util#Slash()
if stridx(expand('%:p:h', 1), join(['src', 'main', 'java'], sep)) >= 0
let output_dir = join ([output_dir, 'target', 'classes'], sep)
if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory']
endif
endif
if stridx(expand('%:p:h', 1), join(['src', 'test', 'java'], sep)) >= 0
let output_dir = join([output_dir, 'target', 'test-classes'], sep)
if has_key(mvn_properties, 'project.build.testOutputDirectory')
let output_dir = mvn_properties['project.build.testOutputDirectory']
let src_main_dir = get(mvn_properties, 'project.build.sourceDirectory', join(['src', 'main', 'java'], sep))
let src_test_dir = get(mvn_properties, 'project.build.testsourceDirectory', join(['src', 'test', 'java'], sep))
if stridx(expand('%:p:h', 1), src_main_dir) >= 0
let output_dir = get(mvn_properties, 'project.build.outputDirectory', join ([output_dir, 'target', 'classes'], sep))
endif
if stridx(expand('%:p:h', 1), src_test_dir) >= 0
let output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join([output_dir, 'target', 'test-classes'], sep))
endif
if has('win32unix')

@ -18,21 +18,31 @@ if !exists('g:syntastic_javascript_eslint_sort')
let g:syntastic_javascript_eslint_sort = 1
endif
if !exists('g:syntastic_javascript_eslint_generic')
let g:syntastic_javascript_eslint_generic = 0
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_eslint_IsAvailable() dict
if g:syntastic_javascript_eslint_generic
call self.log('generic eslint, exec =', self.getExec())
endif
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])
return g:syntastic_javascript_eslint_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [0, 1])
endfunction
function! SyntaxCheckers_javascript_eslint_GetLocList() dict
if !g:syntastic_javascript_eslint_generic
call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args',
\ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
endif
let makeprg = self.makeprgBuild({ 'args_before': '-f compact' })
let makeprg = self.makeprgBuild({ 'args_before': (g:syntastic_javascript_eslint_generic ? '' : '-f compact') })
let errorformat =
\ '%E%f: line %l\, col %c\, Error - %m,' .
@ -43,9 +53,17 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'] })
if !g:syntastic_javascript_eslint_generic
if !exists('s:eslint_new')
let s:eslint_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1])
endif
if !s:eslint_new
for e in loclist
let e['col'] += 1
endfor
endif
endif
return loclist
endfunction

@ -29,12 +29,12 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict
endfunction
function! SyntaxCheckers_javascript_flow_GetLocList() dict
if findfile('.flowconfig', escape(expand('%:p:h', 1), ' ') . ';') ==# ''
if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# ''
return []
endif
let makeprg = self.makeprgBuild({
\ 'exe': self.getExecEscaped() . ' status',
\ 'exe': self.getExecEscaped() . ' check',
\ 'args_after': '--show-all-errors --json' })
let errorformat =

@ -21,16 +21,25 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jscs_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 1])
endfunction
function! SyntaxCheckers_javascript_jscs_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter checkstyle' })
let makeprg = self.makeprgBuild({
\ 'args_after': '--no-colors --max-errors -1 --reporter json' })
let errorformat = '%f:%t:%l:%c:%m'
let errorformat = '%f:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'checkstyle',
\ 'preprocess': 'jscs',
\ 'defaults': {'type': 'E'},
\ 'returns': [0, 2] })
endfunction

@ -18,15 +18,20 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
let jsxhint_version = syntastic#util#system(self.getExecEscaped() . ' --version')
if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>')
if !executable(self.getExec())
return 0
endif
let ver = syntastic#util#parseVersion(jsxhint_version)
call self.setVersion(ver)
let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
let parsed_ver = !v:shell_error && (version_output =~# '\m^JSXHint\>') ? syntastic#util#parseVersion(version_output) : []
if len(parsed_ver)
call self.setVersion(parsed_ver)
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker javascript/jsxhint: can't parse version string (abnormal termination?)")
endif
return syntastic#util#versionIsAtLeast(ver, [0, 4, 1])
return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1])
endfunction
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict

@ -0,0 +1,40 @@
"============================================================================
"File: mixedindentlint.vim
"Description: Mixed indentation linter for vim
"Maintainer: Payton Swick <payton@foolord.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_javascript_mixedindentlint_checker')
finish
endif
let g:loaded_syntastic_javascript_mixedindentlint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_mixedindentlint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = 'Line %l in "%f" %.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'defaults': { 'text': 'Indentation differs from rest of file' },
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'mixedindentlint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -14,14 +14,22 @@ if exists('g:loaded_syntastic_javascript_standard_checker')
endif
let g:loaded_syntastic_javascript_standard_checker = 1
if !exists('g:syntastic_javascript_standard_generic')
let g:syntastic_javascript_standard_generic = 0
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_standard_IsAvailable() dict
if g:syntastic_javascript_standard_generic
call self.log('generic standard, exec =', self.getExec())
endif
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
return g:syntastic_javascript_standard_generic || syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
endfunction
function! SyntaxCheckers_javascript_standard_GetLocList() dict

@ -23,14 +23,15 @@ function! SyntaxCheckers_nix_nix_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--parse-only' })
let errorformat =
\ '%m\, at %f:%l:%c,' .
\ '%m at %f\, line %l:,' .
\ 'error: %m\, in %f'
\ '%f:%l:%c:%m,' .
\ '%f:%l:%m,' .
\ '%f:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
\ 'defaults': {'type': 'e'},
\ 'preprocess': 'nix' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_nroff_igor_checker')
endif
let g:loaded_syntastic_nroff_igor_checker = 1
runtime! syntax_checkers/docbk/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nroff',
\ 'name': 'igor',

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_objc_oclint_checker')
endif
let g:loaded_syntastic_objc_oclint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objc',
\ 'name': 'oclint',

@ -14,8 +14,6 @@ if exists('g:loaded_syntastic_objcpp_oclint_checker')
endif
let g:loaded_syntastic_objcpp_oclint_checker = 1
runtime! syntax_checkers/c/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objcpp',
\ 'name': 'oclint',

@ -51,12 +51,6 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict
endfunction
function! SyntaxCheckers_perl_perl_GetLocList() dict
if !exists('g:syntastic_enable_perl_checker') || !g:syntastic_enable_perl_checker
call syntastic#log#error('checker perl/perl: checks disabled for security reasons; ' .
\ 'set g:syntastic_enable_perl_checker to 1 to override')
return []
endif
if type(g:syntastic_perl_lib_path) == type('')
call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list')
let includes = split(g:syntastic_perl_lib_path, ',')
@ -91,7 +85,8 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'perl',
\ 'name': 'perl'})
\ 'name': 'perl',
\ 'enable': 'enable_perl_checker'})
let &cpo = s:save_cpo
unlet s:save_cpo

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_perl_podchecker_checker')
endif
let g:loaded_syntastic_perl_podchecker_checker = 1
runtime! syntax_checkers/pod/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'perl',
\ 'name': 'podchecker',

@ -16,13 +16,14 @@ set cpo&vim
function! SyntaxCheckers_python_mypy_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f\, line %l: %m'
let errorformat = '%f:%l:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': { 'type': 'E' },
\ 'returns': [0, 1] })
\ 'returns': [0, 1],
\ 'preprocess': 'mypy' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -1,7 +1,7 @@
"============================================================================
"File: pylint.vim
"Description: Syntax checking plugin for syntastic.vim
"Author: Parantapa Bhattacharya <parantapa at gmail dot com>
"Maintainer: Parantapa Bhattacharya <parantapa at gmail dot com>
"
"============================================================================
@ -32,13 +32,14 @@ function! SyntaxCheckers_python_pylint_IsAvailable() dict
" 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(syntastic#util#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.setVersion(ver)
let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
let pylint_version = filter( split(version_output, '\m, \=\|\n'), 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
let parsed_ver = syntastic#util#parseVersion(substitute(pylint_version, '\v^\S+\s+', '', ''))
call self.setVersion(parsed_ver)
let s:pylint_new = syntastic#util#versionIsAtLeast(ver, [1])
let s:pylint_new = syntastic#util#versionIsAtLeast(parsed_ver, [1])
catch /\m^Vim\%((\a\+)\)\=:E684/
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)")
let s:pylint_new = -1
endtry

@ -0,0 +1,39 @@
"============================================================================
"File: qmllint.vim
"Description: Syntax checking plugin for syntastic.vim using qmllint
"Maintainer: Peter Wu <peter@lekensteyn.nl>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_qml_qmllint_checker')
finish
endif
let g:loaded_syntastic_qml_qmllint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_qml_qmllint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l : %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'returns': [0, 255] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'qml',
\ 'name': 'qmllint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -44,7 +44,6 @@ endfunction
function! SyntaxCheckers_r_lint_GetLocList() dict
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
let setwd = 'setwd("' . escape(getcwd(), '"\') . '"); '
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
\ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' .
\ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') .

@ -0,0 +1,81 @@
"============================================================================
"File: lintr.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jim Hester <james.f.hester at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Security:
"
" This checker runs the code in your file. This is probably fine if you
" wrote the file yourself, but it can be a problem if you're trying to
" check third party files. If you are 100% willing to let Vim run the
" code in your file, set g:syntastic_enable_r_lintr_checker to 1 in
" your vimrc to enable this checker:
"
" let g:syntastic_enable_r_lintr_checker = 1
if exists("g:loaded_syntastic_r_lintr_checker")
finish
endif
let g:loaded_syntastic_r_lintr_checker = 1
if !exists('g:syntastic_r_lintr_linters')
let g:syntastic_r_lintr_linters = 'default_linters'
endif
if !exists('g:syntastic_r_lintr_cache')
let g:syntastic_r_lintr_cache = 'FALSE'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_r_lintr_GetHighlightRegex(item)
let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'")
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_r_lintr_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
call system(self.getExecEscaped() . ' --slave --no-restore --no-save -e ' . syntastic#util#shescape('library(lintr)'))
return v:shell_error == 0
endfunction
function! SyntaxCheckers_r_lintr_GetLocList() dict
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
let makeprg = self.getExecEscaped() . ' --slave --no-restore --no-save' .
\ ' -e ' . syntastic#util#shescape(setwd . 'suppressPackageStartupMessages(library(lintr)); ' .
\ 'lint(cache = ' . g:syntastic_r_lintr_cache . ', commandArgs(TRUE), ' . g:syntastic_r_lintr_linters . ')') .
\ ' --args ' . syntastic#util#shexpand('%')
let errorformat =
\ '%W%f:%l:%c: style: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%E%f:%l:%c: error: %m,'
call self.setWantSort(1)
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'r',
\ 'name': 'lintr',
\ 'exec': 'R',
\ 'enable': 'enable_r_lintr_checker'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -46,11 +46,6 @@ function! SyntaxCheckers_r_svtools_IsAvailable() dict
endfunction
function! SyntaxCheckers_r_svtools_GetLocList() dict
if !exists('g:syntastic_enable_r_svtools_checker') || !g:syntastic_enable_r_svtools_checker
call syntastic#log#error('checker r/svtools: checks disabled for security reasons; set g:syntastic_enable_r_svtools_checker to 1 to override')
return []
endif
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
\ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' .
@ -70,7 +65,8 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'r',
\ 'name': 'svtools',
\ 'exec': 'R' })
\ 'exec': 'R',
\ 'enable': 'enable_r_svtools_checker'})
let &cpo = s:save_cpo
unlet s:save_cpo

@ -0,0 +1,23 @@
"============================================================================
"File: lintr.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jim Hester <james.f.hester at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_rmd_lintr_checker')
finish
endif
let g:loaded_syntastic_rmd_lintr_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'rmd',
\ 'name': 'lintr',
\ 'redirect': 'r/lintr'})
" vim: set sw=4 sts=4 et fdm=marker:

@ -29,9 +29,9 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict
let srcdir = syntastic#util#var('rst_sphinx_source_dir')
call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir)
if srcdir == ''
let config = findfile('conf.py', escape(expand('%:p:h', 1), ' ') . ';')
if config == '' || !filereadable(config)
if srcdir ==# ''
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
if config ==# '' || !filereadable(config)
call self.log('conf.py file not found')
return []
endif
@ -40,9 +40,9 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict
let confdir = syntastic#util#var('rst_sphinx_config_dir')
call self.log('g:syntastic_rst_sphinx_config_dir =', confdir)
if confdir == ''
let config = findfile('conf.py', escape(expand('%:p:h', 1), ' ') . ';')
let confdir = (config != '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
if confdir ==# ''
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
let confdir = (config !=# '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
endif
let makeprg = self.makeprgBuild({

@ -0,0 +1,72 @@
"============================================================================
"File: flog.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_ruby_flog_checker')
finish
endif
let g:loaded_syntastic_ruby_flog_checker = 1
if !exists('g:syntastic_ruby_flog_threshold_warning')
let g:syntastic_ruby_flog_threshold_warning = 45
endif
if !exists('g:syntastic_ruby_flog_threshold_error')
let g:syntastic_ruby_flog_threshold_error = 90
endif
if !exists('g:syntastic_ruby_flog_sort')
let g:syntastic_ruby_flog_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_ruby_flog_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args': '-a' })
" Example output:
" 93.25: MyClass::my_method my_file:42
let errorformat = '%\m%\s%#%m: %.%# %f:%l'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
let trail_w = syntastic#util#float2str(g:syntastic_ruby_flog_threshold_warning) . ')'
let trail_e = syntastic#util#float2str(g:syntastic_ruby_flog_threshold_error) . ')'
for e in loclist
let score = syntastic#util#str2float(e['text'])
let e['text'] = 'Complexity is too high (' . syntastic#util#float2str(score) . '/'
if score < g:syntastic_ruby_flog_threshold_warning
let e['valid'] = 0
elseif score < g:syntastic_ruby_flog_threshold_error
let e['type'] = 'W'
let e['text'] .= trail_w
else
let e['type'] = 'E'
let e['text'] .= trail_e
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ruby',
\ 'name': 'flog'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -0,0 +1,22 @@
"============================================================================
"File: mixedindentlint.vim
"Description: Mixed indentation linter for vim
"Maintainer: Payton Swick <payton@foolord.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_scss_mixedindentlint_checker')
finish
endif
let g:loaded_syntastic_scss_mixedindentlint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'mixedindentlint',
\ 'redirect': 'javascript/mixedindentlint'})
" vim: set et sts=4 sw=4:

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_scss_sass_checker')
endif
let g:loaded_syntastic_scss_sass_checker = 1
runtime! syntax_checkers/sass/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'sass',

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_scss_sassc_checker')
endif
let g:loaded_syntastic_scss_sassc_checker = 1
runtime! syntax_checkers/sass/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'sassc',

@ -21,21 +21,28 @@ function! SyntaxCheckers_scss_scss_lint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 12])
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 29])
endfunction
function! SyntaxCheckers_scss_scss_lint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let makeprg = self.makeprgBuild({ 'args_after': '-f JSON' })
let errorformat = '%f:%l [%t] %m'
let errorformat = '%f:%t:%l:%c:%n:%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'scss_lint',
\ 'postprocess': ['guards'],
\ 'returns': [0, 1, 2, 65, 66] })
let cutoff = strlen('Syntax Error: ')
for e in loclist
if e['nr'] > 1
let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['col'] + e['nr']) . 'c'
endif
let e['nr'] = 0
if e['text'][: cutoff-1] ==# 'Syntax Error: '
let e['text'] = e['text'][cutoff :]
else

@ -0,0 +1,23 @@
"============================================================================
"File: stylelint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_scss_stylelint_checker')
finish
endif
let g:loaded_syntastic_scss_stylelint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'stylelint',
\ 'redirect': 'css/stylelint'})
" vim: set sw=4 sts=4 et fdm=marker:

@ -0,0 +1,39 @@
"============================================================================
"File: slim_lint.vim
"Description: Slim style and syntax checker plugin for Syntastic
"Maintainer: Vasily Kolesnikov <re.vkolesnikov@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_slim_slim_lint_checker')
finish
endif
let g:loaded_syntastic_slim_slim_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_slim_slim_lint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l [%t] %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style'})
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'slim',
\ 'name': 'slim_lint',
\ 'exec': 'slim-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -0,0 +1,50 @@
"============================================================================
"File: sqlint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Steve Purcell <steve@sanityinc.com>
"License: MIT
"============================================================================
if exists('g:loaded_syntastic_sql_sqlint_checker')
finish
endif
let g:loaded_syntastic_sql_sqlint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_sql_sqlint_GetHighlightRegex(i)
let term = matchstr(a:i['text'], '\m at or near "\zs[^"]\+\ze"')
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_sql_sqlint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 0, 3])
endfunction
function! SyntaxCheckers_sql_sqlint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%E%f:%l:%c:ERROR %m,' .
\ '%W%f:%l:%c:WARNING %m,' .
\ '%C %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'sql',
\ 'name': 'sqlint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -0,0 +1,43 @@
"============================================================================
"File: stylint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_stylus_stylint_checker')
finish
endif
let g:loaded_syntastic_stylus_stylint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_stylus_stylint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%WWarning: %m,' .
\ '%EError: %m,' .
\ '%CFile: %f,' .
\ '%CLine: %l:%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'stylus',
\ 'name': 'stylint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_text_igor_checker')
endif
let g:loaded_syntastic_text_igor_checker = 1
runtime! syntax_checkers/docbk/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'text',
\ 'name': 'igor',

@ -0,0 +1,23 @@
"============================================================================
"File: eslint.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_typescript_eslint_checker')
finish
endif
let g:loaded_syntastic_typescript_eslint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'typescript',
\ 'name': 'eslint',
\ 'redirect': 'javascript/eslint'})
" vim: set sw=4 sts=4 et fdm=marker:

@ -2,6 +2,7 @@
"File: tsc.vim
"Description: TypeScript syntax checker
"Maintainer: Bill Casarin <bill@casarin.ca>
"
"============================================================================
if exists('g:loaded_syntastic_typescript_tsc_checker')
@ -16,24 +17,28 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_typescript_tsc_GetLocList() dict
if !exists('s:tsc_new')
let s:tsc_new = -1
try
let tsc_version = filter(split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\n'), 'v:val =~# ''\m\<Version ''')[0]
let ver = syntastic#util#parseVersion(tsc_version, '\v<Version \zs\d+(\.\d+)\ze')
call self.setVersion(ver)
function! SyntaxCheckers_typescript_tsc_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
let version_output = split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\<Version ''')
let parsed_ver = len(ver) ? syntastic#util#parseVersion(ver[0], '\v<Version \zs\d+(\.\d+)\ze') : []
let s:tsc_new = syntastic#util#versionIsAtLeast(ver, [1, 5])
catch /\m^Vim\%((\a\+)\)\=:E684/
if len(parsed_ver)
call self.setVersion(parsed_ver)
let s:tsc_new = syntastic#util#versionIsAtLeast(parsed_ver, [1, 5])
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', version_output)
call syntastic#log#error("checker typescript/tsc: can't parse version string (abnormal termination?)")
endtry
let s:tsc_new = -1
endif
if s:tsc_new < 0
return []
endif
return s:tsc_new >= 0
endfunction
function! SyntaxCheckers_typescript_tsc_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': '--module commonjs',
\ 'args_after': (s:tsc_new ? '--noEmit' : '--out ' . syntastic#util#DevNull()) })
@ -47,6 +52,7 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() dict
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr('')} })
endfunction

@ -22,9 +22,13 @@ function! SyntaxCheckers_typescript_tslint_GetHighlightRegex(item)
endfunction
function! SyntaxCheckers_typescript_tslint_GetLocList() dict
if !exists('s:tslint_new')
let s:tslint_new = syntastic#util#versionIsAtLeast(self.getVersion(), [2, 4])
endif
let makeprg = self.makeprgBuild({
\ 'args_after': '--format verbose',
\ 'fname_before': '-f' })
\ 'fname_before': (s:tslint_new ? '' : '-f') })
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter
let errorformat = '%f[%l\, %c]: %m'

@ -0,0 +1,38 @@
"============================================================================
"File: iverilog.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Psidium <psiidium at gmail dot com>
"License: The MIT License
"============================================================================
if exists('g:loaded_syntastic_verilog_iverilog_checker')
finish
endif
let g:loaded_syntastic_verilog_iverilog_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_verilog_iverilog_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_before': '-t null',
\ 'args': '-Wall' })
let errorformat =
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,' .
\ '%E%f:%l: : %m,' .
\ '%W%f:%l: : %m,' .
\ '%f:%l: %m'
return SyntasticMake({'makeprg': makeprg, 'errorformat': errorformat})
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'verilog',
\ 'name': 'iverilog'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -0,0 +1,55 @@
"============================================================================
"File: vcom.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jim Vogel <jim dot e dot vogel at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_vhdl_vcom_checker')
finish
endif
let g:loaded_syntastic_vhdl_vcom_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_vhdl_vcom_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '-lint' })
let errorformat =
\ '** %tRROR: %f(%l): %m,' .
\ '** %tRROR: %m,' .
\ '** %tARNING: %f(%l): %m,' .
\ '** %tARNING: %m,' .
\ '** %tOTE: %m,' .
\ '%tRROR: %f(%l): %m,' .
\ '%tARNING[%*[0-9]]: %f(%l): %m,' .
\ '%tRROR: %m,' .
\ '%tARNING[%*[0-9]]: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
for e in loclist
if e['type'] !=? 'E' && e['type'] !=? 'W'
let e['type'] = 'W'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'vhdl',
\ 'name': 'vcom'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -74,6 +74,8 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1
endif
endif
call self.log('options =', param)
return vimlint#vimlint(expand('%', 1), param)
endfunction " }}}1

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_xhtml_jshint_checker')
endif
let g:loaded_syntastic_xhtml_jshint_checker = 1
runtime! syntax_checkers/html/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'xhtml',
\ 'name': 'jshint',

@ -0,0 +1,51 @@
"============================================================================
"File: basex.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: James Wright <james dot jw at hotmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
"
"============================================================================
if exists('g:loaded_syntastic_xquery_basex_checker')
finish
endif
let g:loaded_syntastic_xquery_basex_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_xquery_basex_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '-z',
\ 'fname_before': '-q',
\ 'fname': syntastic#util#shescape('inspect:module("' . escape(expand('%:p', 1), '"') . '")') })
let errorformat =
\ '%f:%l:%c:%t:%n:%m,' .
\ '%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'basex' })
for e in loclist
if e['type'] !=# 'W' && e['type'] !=# 'E'
let e['type'] = 'E'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'xquery',
\ 'name': 'basex'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -15,8 +15,6 @@ if exists('g:loaded_syntastic_xslt_xmllint_checker')
endif
let g:loaded_syntastic_xslt_xmllint_checker = 1
runtime! syntax_checkers/xml/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'xslt',
\ 'name': 'xmllint',

@ -28,6 +28,7 @@ function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict
let errorformat =
\ 'Error on line %l\, col %c:%m,' .
\ 'JS-YAML: %m at line %l\, column %c:,' .
\ 'YAMLException: %m at line %l\, column %c:,' .
\ '%-G%.%#'
return SyntasticMake({

@ -0,0 +1,52 @@
"============================================================================
"File: yamllint.vim
"Description: YAML files linting for syntastic.vim
"Maintainer: Adrien Vergé
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_yaml_yamllint_checker')
finish
endif
let g:loaded_syntastic_yaml_yamllint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_yaml_yamllint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-f parsable' })
let errorformat =
\ '%f:%l:%c: [%trror] %m,' .
\ '%f:%l:%c: [%tarning] %m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'returns': [0, 1] })
for e in loclist
if e['type'] ==? 'W'
let e['subtype'] = 'Style'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'yaml',
\ 'name': 'yamllint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:
Loading…
Cancel
Save