Squashed 'vim/bundle/syntastic/' changes from 106c772b0..56e19eb81

56e19eb81 Sphinx checker: update maintainer's address.
131ec84e6 New checker for reStructuredText: sphinx.
e46c64701 Bug fix: more findfile() fun.
a728268d7 Bug fix: finding files in parent directories.
98e79d85f Nix checker: cleanup.
c840655d1 Add support for .nix files
b609b3bdd Checker ghc-mod: attempt to fix filename encodings.
84b4da7cf Manual: add a note about :mksession.
b8682c302 Merge remote-tracking branch 'origin/pr/1447'
3dda9b833 Apps should be used for include_lib too
cb9424c9e README: formatting.
7055ff936 Crystal external checker
0470fff0c Checker python/pylama: add option "--force".
e15ebd336 Go checker: no longer attempt to redirect output of "go build".
5c6e78a27 README: suggest a safer cabbrev in FAQ.
a7fde99ea Add support for Vera++ C++ checker
25ad02e12 README: add a link to the vim-eastwood plugin.
981196fdc Flow checker: use the "status" command.
ae405fed8 Manual: add a note about zsh and rvm with MacVim.
5dba05af4 Bashate: make errorformat more permissive.
48b75c455 Tslint is a style checker.
a8771fe6b Puppet-lint checker: --log-format now expects %{line}.
24bb29357 Minor comment fix.
4605886ea Safer opening of the error window (@blueyed).
3a30321fd Fix loclist timestamps for refresh (@blueyed).
9af644dac Remove comments from the tidy checker.
4fbe5f52c Flow checker: recover from negative end offsets.
48090a19f Updates to the manual.
615c890e7 Gfortran checker: bug fix: column handling and sorting for ifort.
b152ac3db The gfortran checker now supports Intel Fortran.
80c5a047c Bug fix: b:cflags again.
2cf32d7be Bug fix: b:cflags applies only to C and C++ checkers.
fe436371b Checker tsc: version 1.5 has option "--noEmit".
a17db15e7 In some cases vim will set the filetype of *.pp files to 'pe-puppet' instead of 'puppet'. There is no functional difference so lets map 'pe-puppet' to 'puppet' so we can use the same default checkers.
710a854f6 Remove shellcheck checker for zsh
ebfba7ec3 Puppet-lint no longer requires puppet.
2337c65b3 Keep track of b:changedtick.
dac07db61 Cleanup: shut up most vint warnings.
ac96ae4a2 Manual: add notes about powerline, vim-airline, and vim-go.
ebadf9aff Windows brain damage: executable('foo') doesn't mean 'foo' is executable.
b905f6d08 Mercury checker: cleanup.
4e0ac804c added mercury syntax checker
0cde75895 replaced erlang checker with the one from vimerl that works without rebar
84add5b7f Checkers using curl(1): allow redirections.
7b8526b96 Flow checker: bail out if there is no .flowconfig.
5b0d3dc8b README: rephrase.
da1ecc0bb FAQ: add a note about $PATH.
231a78f5d Manual: update.
67fc031e0 Manual: fix examples to use g:syntastic_shell.
47eabae37 New global option: "shell".
869c5a726 Camlp4o checker: better error highlighting.
48812d833 Cleanup: exit codes are meaningless for checkers without exec.
c297fbebb README: update address of tidy-html5.
69d20efc6 Elixir: handle warnings.
fe3a48f33 Ruby checkers: make warning flags configurable.
272fc7df3 Manual: update the note about vim-auto-save.
413cdb354 Flow checker: make exe configurable.
5214f00a1 New checker for API Blueprint: snowcrash.
a7758aa18 New checker for Vim: vint.
b427af1e0 Cleanup: case-sensitive comparisons.
0e23cb097 Cleanup.
fc8f8e500 RAEDME: minor rephrase.
9e5a6e657 README: add a link to vint-syntastic.
2a07c4acd New checker for SML: smlnj.
c45293538 README: add a link syntastic-more.
399389c84 README: add links to a few third party checkers.
c233c9bbd README: update URL for the Rust checker.
f4b064e2d README: rephrase.
71aa71bc1 README: more details about enabling checkers.
bccfdea4e Handling redefinition of exec: minor optimisation.
8256e4351 Typo.
471ce96af Remove the xcrun checker for Swift.
d73546dd4 Java checker: more path fixes.
cf4e18d3f Java checker: fix path detection.
776d4175c Handle redefinition of exec after the checker has run.
478218402 Security: disable the swift/xcrun checker by default.
372daff1a Reek checker: update.
157ad8d43 Minor cleanup.
a7841c869 Minor cleanup.
dde4a9be9 Formatting.
4401a23f2 Merge pull request #1323 from Shizmob/patch-1
b70e9af18 Don't warn on python/prospector with no messages.
7cbb79b73 More detailed debug information.
c1a209895 New checker for JavaScript: standard.
1c6cae0d2 Merge pull request #1320 from ametheus/patch-1
0a310ca0a Fix typo
3ea613f53 Xmllint: make "--xinclude" and "--postvalid" optional.
7d9aec0be Prospector no longer accepts option "--external-config".
6b76c26cb Puppet checker: don't redirect stderr when checking version.
abff1d81e Merge pull request #1313 from tomfogg/master
5cc56dbde missing comma in swift errorformat after cleanup
b69efd072 README: Swift is now supported.
cf012bdea Version logging: minor cleanup.
b9608e77b Xcrun: cleanup.
46fc1ec68 Merge branch 'master' of https://github.com/scrooloose/syntastic
3e33785d8 add licence for swift syntax checker
a76370c14 add swift syntax checker support using xcrun

git-subtree-dir: vim/bundle/syntastic
git-subtree-split: 56e19eb81a5cdf75542def5b0b07f68aab50809f
main
Buddy Sandidge 10 years ago
parent 0c33f9ea27
commit 347aeab113

@ -29,14 +29,15 @@
4.3. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5) 4.3. [Are there any local checkers for HTML5 that I can use with syntastic?](#faqhtml5)
4.4. [The `perl` checker has stopped working...](#faqperl) 4.4. [The `perl` checker has stopped working...](#faqperl)
4.5. [What happened to the `rustc` checker?](#faqrust) 4.5. [What happened to the `rustc` checker?](#faqrust)
4.6. [I run a checker and the location list is not updated...](#faqloclist) 4.6. [What happened to the `xcrun` checker?](#faqxcrun)
4.6. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist) 4.7. [I run a checker and the location list is not updated...](#faqloclist)
4.7. [How can I pass additional arguments to a checker?](#faqargs) 4.7. [I run`:lopen` or `:lwindow` and the error window is empty...](#faqloclist)
4.8. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers) 4.8. [How can I pass additional arguments to a checker?](#faqargs)
4.9. [What is the difference between syntax checkers and style checkers?](#faqstyle) 4.9. [Syntastic supports several checkers for my filetype - how do I tell which one(s) to use?](#faqcheckers)
4.10. [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.10. [What is the difference between syntax checkers and style checkers?](#faqstyle)
4.11. [How can I jump between the different errors without using the location list at the bottom of the window?](#faqlnext) 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.12. [The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?](#faqbdelete) 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) 5. [Resources](#otherresources)
- - - - - -
@ -51,18 +52,23 @@ can be done on demand, or automatically as files are saved. If syntax errors
are detected, the user is notified and is happy because they didn't have to 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. compile their code or execute their script to find them.
At the time of this writing, syntax checking plugins exist for ActionScript, At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Ada, API Blueprint, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C,
Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml,
Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex,
LISP, LLVM intermediate language, Lua, Markdown, MATLAB, NASM, Objective-C, Limbo, LISP, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM,
Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and Nix, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
iOS property lists, Puppet, Python, R, Racket, Relax NG, reStructuredText, RPM Object, OS X and iOS property lists, Puppet, Python, R, Racket, Relax NG,
spec, Ruby, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, Tcl,
Verilog, VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT,
and zsh. See the [wiki][3] for details about the corresponding supported YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] for details
checkers. 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].
Below is a screenshot showing the methods that Syntastic uses to display syntax 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 errors. Note that, in practise, you will only have a subset of these methods
@ -183,10 +189,32 @@ supported, look at the [wiki][3]. Note that aliases do not work; the actual
executables must be available in your `$PATH`. Symbolic links are okay though. executables must be available in your `$PATH`. Symbolic links are okay though.
You can see syntastic's idea of available checkers by running `:SyntasticInfo`. You can see syntastic's idea of available checkers by running `:SyntasticInfo`.
Another reason it could fail is that either the command line options or the A second probable reason is that none of the available checkers are
error output for a syntax checker may have changed. In this case, make sure you enabled. Syntastic comes preconfigured with a default list of enabled checkers
have the latest version of the syntax checker installed. If it still fails then per filetype, but this list is kept short in order to prevent slowing down Vim
create an issue - or better yet, create a pull request. or trying to run conflicting checks. The command `:SyntasticInfo` will show you
which checkers are enabled. You can tell syntastic which checkers (among the
available ones) you want to run by setting `g:syntastic_<filetype>_checkers` in
your `vimrc` (see [below](#faqcheckers)).
A third possible reason is that the `$PATH` seen by syntastic might not be same
as the `$PATH` in your login shell. Syntastic runs checkers using the shell
pointed to by Vim's `shell` (or by `g:syntastic_shell`, if set), and that's the
shell you need to configure to set the proper `$PATH` and environment variables
for your checkers. You can see syntastic's idea of `$PATH` by running
```vim
:echo syntastic#util#system('echo "$PATH"')
```
on UNIX and Mac OS-X systems, or
```vim
:echo syntastic#util#system('echo %PATH%')
```
on Windows.
Finally, another reason it could fail is that either the command line options
or the error output for a syntax checker may have changed. In this case, make
sure you have the latest version of the syntax checker installed. If it still
fails then post an [issue][4] - or better yet, create a pull request.
<a name="faqpython3"></a> <a name="faqpython3"></a>
@ -204,8 +232,10 @@ __4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?_
[HTML Tidy][18] has a fork named [HTML Tidy for HTML5][19]. It's a drop [HTML Tidy][18] has a fork named [HTML Tidy for HTML5][19]. It's a drop
in replacement, and syntastic can use it without changes. Just install it in replacement, and syntastic can use it without changes. Just install it
somewhere and point `g:syntastic_html_tidy_exec` to its executable. somewhere and point `g:syntastic_html_tidy_exec` to its executable:
```vim
let g:syntastic_html_tidy_exec = 'tidy5'
```
Alternatively, you can install [vnu.jar][21] from the [validator.nu][20] Alternatively, you can install [vnu.jar][21] from the [validator.nu][20]
project and run it as a [HTTP server][23]: project and run it as a [HTTP server][23]:
```sh ```sh
@ -236,14 +266,21 @@ let g:syntastic_enable_perl_checker = 1
__4.5. Q. What happened to the `rustc` checker?__ __4.5. Q. What happened to the `rustc` checker?__
A. It has been included in the [Rust compiler package][12]. If you have A. It is now part of the [rust.vim][12] plugin. If you install this plugin the
a recent version of the Rust compiler, the checker should be picked up checker should be picked up automatically by syntastic.
automatically by syntastic.
<a name="faqxcrun"></a>
__4.6. Q. What happened to the `xcrun` checker?__
A. The `xcrun` checker used to have a security problem and it has been removed.
A better checker for __Swift__ is part of the [vim-swift][24] plugin. If you
install this plugin the checker should be picked up automatically by syntastic.
<a name="faqloclist"></a> <a name="faqloclist"></a>
__4.6. Q. I run a checker and the location list is not updated...__ __4.7. Q. I run a checker and the location list is not updated...__
__4.6. Q. I run`:lopen` or `:lwindow` and the error window is empty...__ __4.7. Q. I run`:lopen` or `:lwindow` and the error window is empty...__
A. By default the location list is changed only when you run the `:Errors` A. By default the location list is changed only when you run the `:Errors`
command, in order to minimise conflicts with other plugins. If you want the command, in order to minimise conflicts with other plugins. If you want the
@ -255,7 +292,7 @@ let g:syntastic_always_populate_loc_list = 1
<a name="faqargs"></a> <a name="faqargs"></a>
__4.7. Q. How can I pass additional arguments to a checker?__ __4.8. Q. How can I pass additional arguments to a checker?__
A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers
that do can be configured using global variables. The general form of the that do can be configured using global variables. The general form of the
@ -271,7 +308,7 @@ See `:help syntastic-checker-options` for more information.
<a name="faqcheckers"></a> <a name="faqcheckers"></a>
__4.8. Q. Syntastic supports several checkers for my filetype - how do I tell it __4.9. Q. Syntastic supports several checkers for my filetype - how do I tell it
which one(s) to use?__ which one(s) to use?__
A. Stick a line like this in your `vimrc`: A. Stick a line like this in your `vimrc`:
@ -312,7 +349,7 @@ filetype of the current file is `php`).
<a name="faqstyle"></a> <a name="faqstyle"></a>
__4.9. Q. What is the difference between syntax checkers and style checkers?__ __4.10. Q. What is the difference between syntax checkers and style checkers?__
A. The errors and warnings they produce are highlighted differently and can A. The errors and warnings they produce are highlighted differently and can
be filtered by different rules, but otherwise the distinction is pretty much be filtered by different rules, but otherwise the distinction is pretty much
@ -342,7 +379,7 @@ See `:help syntastic_quiet_messages` for details.
<a name="faqaggregate"></a> <a name="faqaggregate"></a>
__4.10. Q. I have enabled multiple checkers for the current filetype. How can I __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 of the errors from all of the checkers together?__
A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`: A. Set `g:syntastic_aggregate_errors` to 1 in your `vimrc`:
@ -354,7 +391,7 @@ See `:help syntastic-aggregating-errors` for more details.
<a name="faqlnext"></a> <a name="faqlnext"></a>
__4.11. Q. How can I jump between the different errors without using the location __4.12. Q. How can I jump between the different errors without using the location
list at the bottom of the window?__ list at the bottom of the window?__
A. Vim provides several built-in commands for this. See `:help :lnext` and A. Vim provides several built-in commands for this. See `:help :lnext` and
@ -366,7 +403,7 @@ mappings (among other things).
<a name="faqbdelete"></a> <a name="faqbdelete"></a>
__4.12. Q. The error window is closed automatically when I :quit the current buffer __4.13. Q. The error window is closed automatically when I :quit the current buffer
but not when I :bdelete it?__ but not when I :bdelete it?__
A. There is no safe way to handle that situation automatically, but you can A. There is no safe way to handle that situation automatically, but you can
@ -374,7 +411,7 @@ work around it:
```vim ```vim
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR> nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd lclose\|bdelete cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdelete' : 'bd')<CR>
``` ```
<a name="otherresources"></a> <a name="otherresources"></a>
@ -404,18 +441,24 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[9]: http://valloric.github.io/YouCompleteMe/ [9]: http://valloric.github.io/YouCompleteMe/
[10]: http://perldoc.perl.org/perlrun.html#*-c* [10]: http://perldoc.perl.org/perlrun.html#*-c*
[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide [11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
[12]: https://github.com/rust-lang/rust/ [12]: https://github.com/rust-lang/rust.vim
[13]: http://www.vim.org/ [13]: http://www.vim.org/
[14]: https://github.com/Shougo/neobundle.vim [14]: https://github.com/Shougo/neobundle.vim
[15]: https://github.com/MarcWeber/vim-addon-manager [15]: https://github.com/MarcWeber/vim-addon-manager
[16]: https://github.com/junegunn/vim-plug/ [16]: https://github.com/junegunn/vim-plug/
[17]: https://github.com/gmarik/Vundle.vim [17]: https://github.com/gmarik/Vundle.vim
[18]: http://tidy.sourceforge.net/ [18]: http://tidy.sourceforge.net/
[19]: http://w3c.github.io/tidy-html5/ [19]: http://www.htacg.org/tidy-html5/
[20]: http://about.validator.nu/ [20]: http://about.validator.nu/
[21]: https://github.com/validator/validator/releases/latest [21]: https://github.com/validator/validator/releases/latest
[22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator [22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator
[23]: http://validator.github.io/validator/#standalone [23]: http://validator.github.io/validator/#standalone
[24]: https://github.com/kballard/vim-swift
[25]: https://github.com/OmniSharp/omnisharp-vim
[26]: https://github.com/myint/syntastic-extras
[27]: https://github.com/roktas/syntastic-more
[28]: https://github.com/venantius/vim-eastwood
[29]: https://github.com/rhysd/vim-crystal
<!-- <!--
vim:tw=79:sw=4: vim:tw=79:sw=4:

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_c_autoload") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_c_autoload') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_c_autoload = 1 let g:loaded_syntastic_c_autoload = 1
@ -10,19 +10,19 @@ set cpo&vim
" convenience function to determine the 'null device' parameter " convenience function to determine the 'null device' parameter
" based on the current operating system " based on the current operating system
function! syntastic#c#NullOutput() " {{{2 function! syntastic#c#NullOutput() abort " {{{2
let known_os = has('unix') || has('mac') || syntastic#util#isRunningWindows() let known_os = has('unix') || has('mac') || syntastic#util#isRunningWindows()
return known_os ? '-o ' . syntastic#util#DevNull() : '' return known_os ? '-o ' . syntastic#util#DevNull() : ''
endfunction " }}}2 endfunction " }}}2
" read additional compiler flags from the given configuration file " read additional compiler flags from the given configuration file
" the file format and its parsing mechanism is inspired by clang_complete " the file format and its parsing mechanism is inspired by clang_complete
function! syntastic#c#ReadConfig(file) " {{{2 function! syntastic#c#ReadConfig(file) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
" search upwards from the current file's directory " search upwards from the current file's directory
let config = findfile(a:file, '.;') let config = findfile(a:file, escape(expand('%:p:h', 1), ' ') . ';')
if config == '' if config ==# ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: file not found')
return '' return ''
endif endif
@ -44,7 +44,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
endtry endtry
" filter out empty lines and comments " filter out empty lines and comments
call filter(lines, 'v:val !~ ''\v^(\s*#|$)''') call filter(lines, 'v:val !~# ''\v^(\s*#|$)''')
" remove leading and trailing spaces " remove leading and trailing spaces
call map(lines, 'substitute(v:val, ''\m^\s\+'', "", "")') call map(lines, 'substitute(v:val, ''\m^\s\+'', "", "")')
@ -53,7 +53,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
let parameters = [] let parameters = []
for line in lines for line in lines
let matches = matchstr(line, '\m\C^\s*-I\s*\zs.\+') let matches = matchstr(line, '\m\C^\s*-I\s*\zs.\+')
if matches != '' if matches !=# ''
" this one looks like an absolute path " this one looks like an absolute path
if match(matches, '\m^\%(/\|\a:\)') != -1 if match(matches, '\m^\%(/\|\a:\)') != -1
call add(parameters, '-I' . matches) call add(parameters, '-I' . matches)
@ -69,7 +69,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
endfunction " }}}2 endfunction " }}}2
" GetLocList() for C-like compilers " GetLocList() for C-like compilers
function! syntastic#c#GetLocList(filetype, subchecker, options) " {{{2 function! syntastic#c#GetLocList(filetype, subchecker, options) abort " {{{2
try try
let flags = s:_get_cflags(a:filetype, a:subchecker, a:options) let flags = s:_get_cflags(a:filetype, a:subchecker, a:options)
catch /\m\C^Syntastic: skip checks$/ catch /\m\C^Syntastic: skip checks$/
@ -96,7 +96,7 @@ endfunction " }}}2
" Private functions {{{1 " Private functions {{{1
" initialize c/cpp syntax checker handlers " initialize c/cpp syntax checker handlers
function! s:_init() " {{{2 function! s:_init() abort " {{{2
let s:handlers = [] let s:handlers = []
let s:cflags = {} let s:cflags = {}
@ -118,22 +118,22 @@ function! s:_init() " {{{2
endfunction " }}}2 endfunction " }}}2
" register a handler dictionary object " register a handler dictionary object
function! s:_registerHandler(regex, function, args) " {{{2 function! s:_registerHandler(regex, function, args) abort " {{{2
let handler = {} let handler = {}
let handler["regex"] = a:regex let handler['regex'] = a:regex
let handler["func"] = function(a:function) let handler['func'] = function(a:function)
let handler["args"] = a:args let handler['args'] = a:args
call add(s:handlers, handler) call add(s:handlers, handler)
endfunction " }}}2 endfunction " }}}2
" try to find library with 'pkg-config' " try to find library with 'pkg-config'
" search possible libraries from first to last given " search possible libraries from first to last given
" argument until one is found " argument until one is found
function! s:_checkPackage(name, ...) " {{{2 function! s:_checkPackage(name, ...) abort " {{{2
if executable('pkg-config') if executable('pkg-config')
if !has_key(s:cflags, a:name) if !has_key(s:cflags, a:name)
for pkg in a:000 for pkg in a:000
let pkg_flags = system('pkg-config --cflags ' . pkg) let pkg_flags = syntastic#util#system('pkg-config --cflags ' . pkg)
" since we cannot necessarily trust the pkg-config exit code " since we cannot necessarily trust the pkg-config exit code
" we have to check for an error output as well " we have to check for an error output as well
if v:shell_error == 0 && pkg_flags !~? 'not found' if v:shell_error == 0 && pkg_flags !~? 'not found'
@ -150,10 +150,10 @@ function! s:_checkPackage(name, ...) " {{{2
endfunction " }}}2 endfunction " }}}2
" try to find PHP includes with 'php-config' " try to find PHP includes with 'php-config'
function! s:_checkPhp() " {{{2 function! s:_checkPhp() abort " {{{2
if executable('php-config') if executable('php-config')
if !has_key(s:cflags, 'php') if !has_key(s:cflags, 'php')
let s:cflags['php'] = system('php-config --includes') let s:cflags['php'] = syntastic#util#system('php-config --includes')
let s:cflags['php'] = ' ' . substitute(s:cflags['php'], "\n", '', '') let s:cflags['php'] = ' ' . substitute(s:cflags['php'], "\n", '', '')
endif endif
return s:cflags['php'] return s:cflags['php']
@ -162,10 +162,10 @@ function! s:_checkPhp() " {{{2
endfunction " }}}2 endfunction " }}}2
" try to find the python headers with distutils " try to find the python headers with distutils
function! s:_checkPython() " {{{2 function! s:_checkPython() abort " {{{2
if executable('python') if executable('python')
if !has_key(s:cflags, 'python') if !has_key(s:cflags, 'python')
let s:cflags['python'] = system('python -c ''from distutils import ' . let s:cflags['python'] = syntastic#util#system('python -c ''from distutils import ' .
\ 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''') \ 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''')
let s:cflags['python'] = substitute(s:cflags['python'], "\n", '', '') let s:cflags['python'] = substitute(s:cflags['python'], "\n", '', '')
let s:cflags['python'] = ' -I' . s:cflags['python'] let s:cflags['python'] = ' -I' . s:cflags['python']
@ -176,10 +176,10 @@ function! s:_checkPython() " {{{2
endfunction " }}}2 endfunction " }}}2
" try to find the ruby headers with 'rbconfig' " try to find the ruby headers with 'rbconfig'
function! s:_checkRuby() " {{{2 function! s:_checkRuby() abort " {{{2
if executable('ruby') if executable('ruby')
if !has_key(s:cflags, 'ruby') if !has_key(s:cflags, 'ruby')
let s:cflags['ruby'] = system('ruby -r rbconfig -e ' . let s:cflags['ruby'] = syntastic#util#system('ruby -r rbconfig -e ' .
\ '''puts RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG["archdir"]''') \ '''puts RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG["archdir"]''')
let s:cflags['ruby'] = substitute(s:cflags['ruby'], "\n", '', '') let s:cflags['ruby'] = substitute(s:cflags['ruby'], "\n", '', '')
let s:cflags['ruby'] = ' -I' . s:cflags['ruby'] let s:cflags['ruby'] = ' -I' . s:cflags['ruby']
@ -194,7 +194,7 @@ endfunction " }}}2
" Utilities {{{1 " Utilities {{{1
" resolve checker-related user variables " resolve checker-related user variables
function! s:_get_checker_var(scope, filetype, subchecker, name, default) " {{{2 function! s:_get_checker_var(scope, filetype, subchecker, name, default) abort " {{{2
let prefix = a:scope . ':' . 'syntastic_' let prefix = a:scope . ':' . 'syntastic_'
if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name) if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name)
return {a:scope}:syntastic_{a:filetype}_{a:subchecker}_{a:name} return {a:scope}:syntastic_{a:filetype}_{a:subchecker}_{a:name}
@ -206,7 +206,7 @@ function! s:_get_checker_var(scope, filetype, subchecker, name, default) " {{{2
endfunction " }}}2 endfunction " }}}2
" resolve user CFLAGS " resolve user CFLAGS
function! s:_get_cflags(ft, ck, opts) " {{{2 function! s:_get_cflags(ft, ck, opts) abort " {{{2
" determine whether to parse header files as well " determine whether to parse header files as well
if has_key(a:opts, 'header_names') && expand('%', 1) =~? a:opts['header_names'] if has_key(a:opts, 'header_names') && expand('%', 1) =~? a:opts['header_names']
if s:_get_checker_var('g', a:ft, a:ck, 'check_header', 0) if s:_get_checker_var('g', a:ft, a:ck, 'check_header', 0)
@ -223,10 +223,10 @@ function! s:_get_cflags(ft, ck, opts) " {{{2
" check if the user manually set some cflags " check if the user manually set some cflags
let b_cflags = s:_get_checker_var('b', a:ft, a:ck, 'cflags', '') let b_cflags = s:_get_checker_var('b', a:ft, a:ck, 'cflags', '')
if b_cflags == '' if b_cflags ==# ''
if a:ft ==# 'c' || a:ft ==# 'cpp'
" check whether to search for include files at all " check whether to search for include files at all
if !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0) if !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
if a:ft ==# 'c' || a:ft ==# 'cpp'
" refresh the include file search if desired " refresh the include file search if desired
if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0) if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0)
let flags .= ' ' . s:_search_headers() let flags .= ' ' . s:_search_headers()
@ -253,7 +253,7 @@ endfunction " }}}2
" get the gcc include directory argument depending on the default " get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs' " includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! s:_get_include_dirs(filetype) " {{{2 function! s:_get_include_dirs(filetype) abort " {{{2
let include_dirs = [] let include_dirs = []
if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' && if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' &&
@ -271,7 +271,7 @@ endfunction " }}}2
" search the first 100 lines for include statements that are " search the first 100 lines for include statements that are
" given in the handlers dictionary " given in the handlers dictionary
function! s:_search_headers() " {{{2 function! s:_search_headers() abort " {{{2
let includes = '' let includes = ''
let files = [] let files = []
let found = [] let found = []
@ -280,15 +280,15 @@ function! s:_search_headers() " {{{2
" search current buffer " search current buffer
for line in lines for line in lines
let file = matchstr(line, '\m"\zs\S\+\ze"') let file = matchstr(line, '\m"\zs\S\+\ze"')
if file != '' if file !=# ''
call add(files, file) call add(files, file)
continue continue
endif endif
for handler in s:handlers for handler in s:handlers
if line =~# handler["regex"] if line =~# handler['regex']
let includes .= call(handler["func"], handler["args"]) let includes .= call(handler['func'], handler['args'])
call add(found, handler["regex"]) call add(found, handler['regex'])
break break
endif endif
endfor endfor
@ -296,7 +296,7 @@ function! s:_search_headers() " {{{2
" search included headers " search included headers
for hfile in files for hfile in files
if hfile != '' if hfile !=# ''
let filename = expand('%:p:h', 1) . syntastic#util#Slash() . hfile let filename = expand('%:p:h', 1) . syntastic#util#Slash() . hfile
try try
@ -308,14 +308,14 @@ function! s:_search_headers() " {{{2
call filter(lines, 'v:val =~# ''\m^\s*#\s*include''') call filter(lines, 'v:val =~# ''\m^\s*#\s*include''')
for handler in s:handlers for handler in s:handlers
if index(found, handler["regex"]) != -1 if index(found, handler['regex']) != -1
continue continue
endif endif
for line in lines for line in lines
if line =~# handler["regex"] if line =~# handler['regex']
let includes .= call(handler["func"], handler["args"]) let includes .= call(handler['func'], handler['args'])
call add(found, handler["regex"]) call add(found, handler['regex'])
break break
endif endif
endfor endfor

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_log_autoload") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_log_autoload') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_log_autoload = 1 let g:loaded_syntastic_log_autoload = 1
@ -10,24 +10,24 @@ let s:one_time_notices_issued = []
" Public functions {{{1 " Public functions {{{1
function! syntastic#log#info(msg) " {{{2 function! syntastic#log#info(msg) abort " {{{2
echomsg "syntastic: info: " . a:msg echomsg 'syntastic: info: ' . a:msg
endfunction " }}}2 endfunction " }}}2
function! syntastic#log#warn(msg) " {{{2 function! syntastic#log#warn(msg) abort " {{{2
echohl WarningMsg echohl WarningMsg
echomsg "syntastic: warning: " . a:msg echomsg 'syntastic: warning: ' . a:msg
echohl None echohl None
endfunction " }}}2 endfunction " }}}2
function! syntastic#log#error(msg) " {{{2 function! syntastic#log#error(msg) abort " {{{2
execute "normal \<Esc>" execute "normal \<Esc>"
echohl ErrorMsg echohl ErrorMsg
echomsg "syntastic: error: " . a:msg echomsg 'syntastic: error: ' . a:msg
echohl None echohl None
endfunction " }}}2 endfunction " }}}2
function! syntastic#log#oneTimeWarn(msg) " {{{2 function! syntastic#log#oneTimeWarn(msg) abort " {{{2
if index(s:one_time_notices_issued, a:msg) >= 0 if index(s:one_time_notices_issued, a:msg) >= 0
return return
endif endif
@ -37,7 +37,7 @@ function! syntastic#log#oneTimeWarn(msg) " {{{2
endfunction " }}}2 endfunction " }}}2
" @vimlint(EVL102, 1, l:OLD_VAR) " @vimlint(EVL102, 1, l:OLD_VAR)
function! syntastic#log#deprecationWarn(old, new, ...) " {{{2 function! syntastic#log#deprecationWarn(old, new, ...) abort " {{{2
if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new) if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new)
let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use ' let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use '
@ -60,7 +60,7 @@ function! syntastic#log#deprecationWarn(old, new, ...) " {{{2
endfunction " }}}2 endfunction " }}}2
" @vimlint(EVL102, 0, l:OLD_VAR) " @vimlint(EVL102, 0, l:OLD_VAR)
function! syntastic#log#debug(level, msg, ...) " {{{2 function! syntastic#log#debug(level, msg, ...) abort " {{{2
if !s:_isDebugEnabled(a:level) if !s:_isDebugEnabled(a:level)
return return
endif endif
@ -80,7 +80,7 @@ function! syntastic#log#debug(level, msg, ...) " {{{2
call s:_logRedirect(0) call s:_logRedirect(0)
endfunction " }}}2 endfunction " }}}2
function! syntastic#log#debugShowOptions(level, names) " {{{2 function! syntastic#log#debugShowOptions(level, names) abort " {{{2
if !s:_isDebugEnabled(a:level) if !s:_isDebugEnabled(a:level)
return return
endif endif
@ -88,7 +88,7 @@ function! syntastic#log#debugShowOptions(level, names) " {{{2
let leader = s:_log_timestamp() let leader = s:_log_timestamp()
call s:_logRedirect(1) call s:_logRedirect(1)
let vlist = copy(type(a:names) == type("") ? [a:names] : a:names) let vlist = copy(type(a:names) == type('') ? [a:names] : a:names)
if !empty(vlist) if !empty(vlist)
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))") call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))")
echomsg leader . join(vlist, ', ') echomsg leader . join(vlist, ', ')
@ -96,7 +96,7 @@ function! syntastic#log#debugShowOptions(level, names) " {{{2
call s:_logRedirect(0) call s:_logRedirect(0)
endfunction " }}}2 endfunction " }}}2
function! syntastic#log#debugShowVariables(level, names) " {{{2 function! syntastic#log#debugShowVariables(level, names) abort " {{{2
if !s:_isDebugEnabled(a:level) if !s:_isDebugEnabled(a:level)
return return
endif endif
@ -104,10 +104,10 @@ function! syntastic#log#debugShowVariables(level, names) " {{{2
let leader = s:_log_timestamp() let leader = s:_log_timestamp()
call s:_logRedirect(1) call s:_logRedirect(1)
let vlist = type(a:names) == type("") ? [a:names] : a:names let vlist = type(a:names) == type('') ? [a:names] : a:names
for name in vlist for name in vlist
let msg = s:_format_variable(name) let msg = s:_format_variable(name)
if msg != '' if msg !=# ''
echomsg leader . msg echomsg leader . msg
endif endif
endfor endfor
@ -115,7 +115,7 @@ function! syntastic#log#debugShowVariables(level, names) " {{{2
call s:_logRedirect(0) call s:_logRedirect(0)
endfunction " }}}2 endfunction " }}}2
function! syntastic#log#debugDump(level) " {{{2 function! syntastic#log#debugDump(level) abort " {{{2
if !s:_isDebugEnabled(a:level) if !s:_isDebugEnabled(a:level)
return return
endif endif
@ -127,11 +127,11 @@ endfunction " }}}2
" Private functions {{{1 " Private functions {{{1
function! s:_isDebugEnabled_smart(level) " {{{2 function! s:_isDebugEnabled_smart(level) abort " {{{2
return and(g:syntastic_debug, a:level) return and(g:syntastic_debug, a:level)
endfunction " }}}2 endfunction " }}}2
function! s:_isDebugEnabled_dumb(level) " {{{2 function! s:_isDebugEnabled_dumb(level) abort " {{{2
" poor man's bit test for bit N, assuming a:level == 2**N " poor man's bit test for bit N, assuming a:level == 2**N
return (g:syntastic_debug / a:level) % 2 return (g:syntastic_debug / a:level) % 2
endfunction " }}}2 endfunction " }}}2
@ -139,8 +139,8 @@ endfunction " }}}2
let s:_isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb') let s:_isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb')
lockvar s:_isDebugEnabled lockvar s:_isDebugEnabled
function! s:_logRedirect(on) " {{{2 function! s:_logRedirect(on) abort " {{{2
if exists("g:syntastic_debug_file") if exists('g:syntastic_debug_file')
if a:on if a:on
try try
execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file, 1)) execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file, 1))
@ -158,11 +158,11 @@ endfunction " }}}2
" Utilities {{{1 " Utilities {{{1
function! s:_log_timestamp() " {{{2 function! s:_log_timestamp() abort " {{{2
return 'syntastic: ' . split(reltimestr(reltime(g:_SYNTASTIC_START)))[0] . ': ' return 'syntastic: ' . split(reltimestr(reltime(g:_SYNTASTIC_START)))[0] . ': '
endfunction " }}}2 endfunction " }}}2
function! s:_format_variable(name) " {{{2 function! s:_format_variable(name) abort " {{{2
let vals = [] let vals = []
if exists('g:syntastic_' . a:name) if exists('g:syntastic_' . a:name)
call add(vals, 'g:syntastic_' . a:name . ' = ' . strtrans(string(g:syntastic_{a:name}))) call add(vals, 'g:syntastic_' . a:name . ' = ' . strtrans(string(g:syntastic_{a:name})))

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_postprocess_autoload") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_postprocess_autoload') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_postprocess_autoload = 1 let g:loaded_syntastic_postprocess_autoload = 1
@ -9,7 +9,7 @@ set cpo&vim
" Public functions {{{1 " Public functions {{{1
" merge consecutive blanks " merge consecutive blanks
function! syntastic#postprocess#compressWhitespace(errors) " {{{2 function! syntastic#postprocess#compressWhitespace(errors) abort " {{{2
for e in a:errors for e in a:errors
let e['text'] = substitute(e['text'], "\001", '', 'g') let e['text'] = substitute(e['text'], "\001", '', 'g')
let e['text'] = substitute(e['text'], '\n', ' ', 'g') let e['text'] = substitute(e['text'], '\n', ' ', 'g')
@ -22,7 +22,7 @@ function! syntastic#postprocess#compressWhitespace(errors) " {{{2
endfunction " }}}2 endfunction " }}}2
" remove spurious CR under Cygwin " remove spurious CR under Cygwin
function! syntastic#postprocess#cygwinRemoveCR(errors) " {{{2 function! syntastic#postprocess#cygwinRemoveCR(errors) abort " {{{2
if has('win32unix') if has('win32unix')
for e in a:errors for e in a:errors
let e['text'] = substitute(e['text'], '\r', '', 'g') let e['text'] = substitute(e['text'], '\r', '', 'g')
@ -33,7 +33,7 @@ function! syntastic#postprocess#cygwinRemoveCR(errors) " {{{2
endfunction " }}}2 endfunction " }}}2
" decode XML entities " decode XML entities
function! syntastic#postprocess#decodeXMLEntities(errors) " {{{2 function! syntastic#postprocess#decodeXMLEntities(errors) abort " {{{2
for e in a:errors for e in a:errors
let e['text'] = syntastic#util#decodeXMLEntities(e['text']) let e['text'] = syntastic#util#decodeXMLEntities(e['text'])
endfor endfor
@ -42,13 +42,13 @@ function! syntastic#postprocess#decodeXMLEntities(errors) " {{{2
endfunction " }}}2 endfunction " }}}2
" filter out errors referencing other files " filter out errors referencing other files
function! syntastic#postprocess#filterForeignErrors(errors) " {{{2 function! syntastic#postprocess#filterForeignErrors(errors) abort " {{{2
return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr('')) return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr(''))
endfunction " }}}2 endfunction " }}}2
" make sure line numbers are not past end of buffers " make sure line numbers are not past end of buffers
" XXX: this loads all referenced buffers in memory " XXX: this loads all referenced buffers in memory
function! syntastic#postprocess#guards(errors) " {{{2 function! syntastic#postprocess#guards(errors) abort " {{{2
let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])')) let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])'))
let guards = {} let guards = {}

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_preprocess_autoload") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_preprocess_autoload') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_preprocess_autoload = 1 let g:loaded_syntastic_preprocess_autoload = 1
@ -8,19 +8,19 @@ set cpo&vim
" Public functions {{{1 " Public functions {{{1
function! syntastic#preprocess#cabal(errors) " {{{2 function! syntastic#preprocess#cabal(errors) abort " {{{2
let out = [] let out = []
let star = 0 let star = 0
for err in a:errors for err in a:errors
if star if star
if err == '' if err ==# ''
let star = 0 let star = 0
else else
let out[-1] .= ' ' . err let out[-1] .= ' ' . err
endif endif
else else
call add(out, err) call add(out, err)
if err =~ '\m^*\s' if err =~# '\m^*\s'
let star = 1 let star = 1
endif endif
endif endif
@ -28,7 +28,7 @@ function! syntastic#preprocess#cabal(errors) " {{{2
return out return out
endfunction " }}}2 endfunction " }}}2
function! syntastic#preprocess#checkstyle(errors) " {{{2 function! syntastic#preprocess#checkstyle(errors) abort " {{{2
let out = [] let out = []
let fname = expand('%', 1) let fname = expand('%', 1)
for err in a:errors for err in a:errors
@ -55,23 +55,28 @@ function! syntastic#preprocess#checkstyle(errors) " {{{2
return out return out
endfunction " }}}2 endfunction " }}}2
function! syntastic#preprocess#cppcheck(errors) " {{{2 function! syntastic#preprocess#cppcheck(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\v^\[[^]]+\]\zs( -\> \[[^]]+\])+\ze:'', "", "")') return map(copy(a:errors), 'substitute(v:val, ''\v^\[[^]]+\]\zs( -\> \[[^]]+\])+\ze:'', "", "")')
endfunction " }}}2 endfunction " }}}2
" @vimlint(EVL102, 1, l:true) " @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false) " @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null) " @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#flow(errors) " {{{2 function! syntastic#preprocess#flow(errors) abort " {{{2
" JSON artifacts " JSON artifacts
let true = 1 let true = 1
let false = 0 let false = 0
let null = '' let null = ''
let idx = 0
while idx < len(a:errors) && a:errors[idx][0] != '{'
let idx += 1
endwhile
" A hat tip to Marc Weber for this trick " 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 " http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
try try
let errs = eval(join(a:errors, '')) let errs = eval(join(a:errors[idx :], ''))
catch catch
let errs = {} let errs = {}
endtry endtry
@ -88,7 +93,7 @@ function! syntastic#preprocess#flow(errors) " {{{2
\ m['path'] . ':' . \ m['path'] . ':' .
\ m['line'] . ':' . \ m['line'] . ':' .
\ m['start'] . ':' . \ m['start'] . ':' .
\ (m['line'] ==# m['endline'] ? m['end'] . ':' : '') . \ (m['line'] ==# m['endline'] && str2nr(m['end']) > 0 ? m['end'] . ':' : '') .
\ ' ' . m['descr'] \ ' ' . m['descr']
if len(t) if len(t)
@ -123,11 +128,18 @@ endfunction " }}}2
" @vimlint(EVL102, 0, l:false) " @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null) " @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#killEmpty(errors) " {{{2 function! syntastic#preprocess#iconv(errors) abort " {{{2
return filter(copy(a:errors), 'v:val != ""') return
\ (has('iconv') || has('iconv/dyn')) && &encoding !=# '' && &encoding !=# 'utf-8' ?
\ map(a:errors, 'iconv(v:val, "utf-8", &encoding)') :
\ a:errors
endfunction " }}}2 endfunction " }}}2
function! syntastic#preprocess#perl(errors) " {{{2 function! syntastic#preprocess#killEmpty(errors) abort " {{{2
return filter(copy(a:errors), 'v:val !=# ""')
endfunction " }}}2
function! syntastic#preprocess#perl(errors) abort " {{{2
let out = [] let out = []
for e in a:errors for e in a:errors
@ -143,7 +155,7 @@ endfunction " }}}2
" @vimlint(EVL102, 1, l:true) " @vimlint(EVL102, 1, l:true)
" @vimlint(EVL102, 1, l:false) " @vimlint(EVL102, 1, l:false)
" @vimlint(EVL102, 1, l:null) " @vimlint(EVL102, 1, l:null)
function! syntastic#preprocess#prospector(errors) " {{{2 function! syntastic#preprocess#prospector(errors) abort " {{{2
" JSON artifacts " JSON artifacts
let true = 1 let true = 1
let false = 0 let false = 0
@ -158,7 +170,8 @@ function! syntastic#preprocess#prospector(errors) " {{{2
endtry endtry
let out = [] let out = []
if type(errs) == type({}) && has_key(errs, 'messages') && type(errs['messages']) == type([]) if type(errs) == type({}) && has_key(errs, 'messages')
if type(errs['messages']) == type([])
for e in errs['messages'] for e in errs['messages']
if type(e) == type({}) if type(e) == type({})
try try
@ -189,6 +202,7 @@ function! syntastic#preprocess#prospector(errors) " {{{2
else else
call syntastic#log#warn('checker python/prospector: unknown error format') call syntastic#log#warn('checker python/prospector: unknown error format')
endif endif
endif
return out return out
endfunction " }}}2 endfunction " }}}2
@ -196,16 +210,16 @@ endfunction " }}}2
" @vimlint(EVL102, 0, l:false) " @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null) " @vimlint(EVL102, 0, l:null)
function! syntastic#preprocess#rparse(errors) " {{{2 function! syntastic#preprocess#rparse(errors) abort " {{{2
let errlist = copy(a:errors) let errlist = copy(a:errors)
" remove uninteresting lines and handle continuations " remove uninteresting lines and handle continuations
let i = 0 let i = 0
while i < len(errlist) while i < len(errlist)
if i > 0 && errlist[i][:1] == ' ' && errlist[i] !~ '\m\s\+\^$' if i > 0 && errlist[i][:1] ==# ' ' && errlist[i] !~# '\m\s\+\^$'
let errlist[i-1] .= errlist[i][1:] let errlist[i-1] .= errlist[i][1:]
call remove(errlist, i) call remove(errlist, i)
elseif errlist[i] !~ '\m^\(Lint:\|Lint checking:\|Error in\) ' elseif errlist[i] !~# '\m^\(Lint:\|Lint checking:\|Error in\) '
call remove(errlist, i) call remove(errlist, i)
else else
let i += 1 let i += 1
@ -222,7 +236,7 @@ function! syntastic#preprocess#rparse(errors) " {{{2
call add(out, 'E:' . fname . ':' . line . ': ' . parts[1]) call add(out, 'E:' . fname . ':' . line . ': ' . parts[1])
endfor endfor
endif endif
if len(parts) >= 5 && parts[4] != '' if len(parts) >= 5 && parts[4] !=# ''
call add(out, 'E:' . fname . ':0: ' . parts[1] . ' - ' . parts[4] . ' messages not shown') call add(out, 'E:' . fname . ':0: ' . parts[1] . ' - ' . parts[4] . ' messages not shown')
endif endif
elseif match(e, '\m^Lint checking: ') == 0 elseif match(e, '\m^Lint checking: ') == 0
@ -235,11 +249,11 @@ function! syntastic#preprocess#rparse(errors) " {{{2
return out return out
endfunction " }}}2 endfunction " }}}2
function! syntastic#preprocess#tslint(errors) " {{{2 function! syntastic#preprocess#tslint(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")') return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
endfunction " }}}2 endfunction " }}}2
function! syntastic#preprocess#validator(errors) " {{{2 function! syntastic#preprocess#validator(errors) abort " {{{2
let out = [] let out = []
for e in a:errors for e in a:errors
let parts = matchlist(e, '\v^"([^"]+)"(.+)') let parts = matchlist(e, '\v^"([^"]+)"(.+)')
@ -254,6 +268,58 @@ function! syntastic#preprocess#validator(errors) " {{{2
return out return out
endfunction " }}}2 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 out = []
if type(errs) == type([])
for e in errs
if type(e) == type({})
try
let msg =
\ e['file_path'] . ':' .
\ e['line_number'] . ':' .
\ e['column_number'] . ':' .
\ e['severity'][0] . ': ' .
\ e['description'] . ' (' .
\ e['policy_name'] . ')'
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker vim/vint: unknown error format')
let out = []
break
endtry
else
call syntastic#log#warn('checker vim/vint: unknown error format')
let out = []
break
endif
endfor
else
call syntastic#log#warn('checker vim/vint: unknown error format')
endif
return out
endfunction " }}}2
" @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false)
" @vimlint(EVL102, 0, l:null)
" }}}1 " }}}1
let &cpo = s:save_cpo let &cpo = s:save_cpo

@ -1,4 +1,4 @@
if exists('g:loaded_syntastic_util_autoload') || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_util_autoload') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_util_autoload = 1 let g:loaded_syntastic_util_autoload = 1
@ -8,11 +8,11 @@ set cpo&vim
" Public functions {{{1 " Public functions {{{1
function! syntastic#util#isRunningWindows() " {{{2 function! syntastic#util#isRunningWindows() abort " {{{2
return has('win16') || has('win32') || has('win64') return has('win16') || has('win32') || has('win64')
endfunction " }}}2 endfunction " }}}2
function! syntastic#util#DevNull() " {{{2 function! syntastic#util#DevNull() abort " {{{2
if syntastic#util#isRunningWindows() if syntastic#util#isRunningWindows()
return 'NUL' return 'NUL'
endif endif
@ -21,28 +21,51 @@ endfunction " }}}2
" Get directory separator " Get directory separator
function! syntastic#util#Slash() abort " {{{2 function! syntastic#util#Slash() abort " {{{2
return (!exists("+shellslash") || &shellslash) ? '/' : '\' return (!exists('+shellslash') || &shellslash) ? '/' : '\'
endfunction " }}}2
function! syntastic#util#CygwinPath(path) abort " {{{2
return substitute(syntastic#util#system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
endfunction " }}}2
function! syntastic#util#system(command) abort " {{{2
let old_shell = &shell
let old_lc_messages = $LC_MESSAGES
let old_lc_all = $LC_ALL
let &shell = syntastic#util#var('shell')
let $LC_MESSAGES = 'C'
let $LC_ALL = ''
let out = system(a:command)
let $LC_ALL = old_lc_all
let $LC_MESSAGES = old_lc_messages
let &shell = old_shell
return out
endfunction " }}}2 endfunction " }}}2
" Create a temporary directory " Create a temporary directory
function! syntastic#util#tmpdir() " {{{2 function! syntastic#util#tmpdir() abort " {{{2
let tempdir = '' let tempdir = ''
if (has('unix') || has('mac')) && executable('mktemp') if (has('unix') || has('mac')) && executable('mktemp')
" TODO: option "-t" to mktemp(1) is not portable " TODO: option "-t" to mktemp(1) is not portable
let tmp = $TMPDIR != '' ? $TMPDIR : $TMP != '' ? $TMP : '/tmp' let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp'
let out = split(system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n") let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n")
if v:shell_error == 0 && len(out) == 1 if v:shell_error == 0 && len(out) == 1
let tempdir = out[0] let tempdir = out[0]
endif endif
endif endif
if tempdir == '' if tempdir ==# ''
if has('win32') || has('win64') if has('win32') || has('win64')
let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid() let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid()
elseif has('win32unix') elseif has('win32unix')
let tempdir = s:CygwinPath('/tmp/vim-syntastic-' . getpid()) let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid())
elseif $TMPDIR != '' elseif $TMPDIR !=# ''
let tempdir = $TMPDIR . '/vim-syntastic-' . getpid() let tempdir = $TMPDIR . '/vim-syntastic-' . getpid()
else else
let tempdir = '/tmp/vim-syntastic-' . getpid() let tempdir = '/tmp/vim-syntastic-' . getpid()
@ -60,7 +83,7 @@ function! syntastic#util#tmpdir() " {{{2
endfunction " }}}2 endfunction " }}}2
" Recursively remove a directory " Recursively remove a directory
function! syntastic#util#rmrf(what) " {{{2 function! syntastic#util#rmrf(what) abort " {{{2
" try to make sure we don't delete directories we didn't create " try to make sure we don't delete directories we didn't create
if a:what !~? 'vim-syntastic-' if a:what !~? 'vim-syntastic-'
return return
@ -74,8 +97,8 @@ function! syntastic#util#rmrf(what) " {{{2
\ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : '' \ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : ''
endif endif
if s:rmrf != '' if s:rmrf !=# ''
silent! call system(s:rmrf . ' ' . syntastic#util#shescape(a:what)) silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
else else
call s:_rmrf(a:what) call s:_rmrf(a:what)
endif endif
@ -94,10 +117,10 @@ endfunction " }}}2
"returns "returns
" "
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']} "{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
function! syntastic#util#parseShebang() " {{{2 function! syntastic#util#parseShebang() abort " {{{2
for lnum in range(1, 5) for lnum in range(1, 5)
let line = getline(lnum) let line = getline(lnum)
if line =~ '^#!' if line =~# '^#!'
let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '') let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '')
let exe = matchstr(line, '\m^\S*\ze') let exe = matchstr(line, '\m^\S*\ze')
let args = split(matchstr(line, '\m^\S*\zs.*')) let args = split(matchstr(line, '\m^\S*\zs.*'))
@ -109,7 +132,7 @@ function! syntastic#util#parseShebang() " {{{2
endfunction " }}}2 endfunction " }}}2
" Get the value of a variable. Allow local variables to override global ones. " Get the value of a variable. Allow local variables to override global ones.
function! syntastic#util#var(name, ...) " {{{2 function! syntastic#util#var(name, ...) abort " {{{2
return return
\ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} : \ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} :
\ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} : \ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} :
@ -117,8 +140,8 @@ function! syntastic#util#var(name, ...) " {{{2
endfunction " }}}2 endfunction " }}}2
" Parse a version string. Return an array of version components. " Parse a version string. Return an array of version components.
function! syntastic#util#parseVersion(version) " {{{2 function! syntastic#util#parseVersion(version, ...) abort " {{{2
return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)') return map(split(matchstr( a:version, a:0 ? a:1 : '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
endfunction " }}}2 endfunction " }}}2
" Verify that the 'installed' version is at least the 'required' version. " Verify that the 'installed' version is at least the 'required' version.
@ -127,13 +150,13 @@ endfunction " }}}2
" the "missing" elements will be assumed to be 0 for the purposes of checking. " the "missing" elements will be assumed to be 0 for the purposes of checking.
" "
" See http://semver.org for info about version numbers. " See http://semver.org for info about version numbers.
function! syntastic#util#versionIsAtLeast(installed, required) " {{{2 function! syntastic#util#versionIsAtLeast(installed, required) abort " {{{2
return syntastic#util#compareLexi(a:installed, a:required) >= 0 return syntastic#util#compareLexi(a:installed, a:required) >= 0
endfunction " }}}2 endfunction " }}}2
" Almost lexicographic comparison of two lists of integers. :) If lists " Almost lexicographic comparison of two lists of integers. :) If lists
" have different lengths, the "missing" elements are assumed to be 0. " have different lengths, the "missing" elements are assumed to be 0.
function! syntastic#util#compareLexi(a, b) " {{{2 function! syntastic#util#compareLexi(a, b) abort " {{{2
for idx in range(max([len(a:a), len(a:b)])) for idx in range(max([len(a:a), len(a:b)]))
let a_element = str2nr(get(a:a, idx, 0)) let a_element = str2nr(get(a:a, idx, 0))
let b_element = str2nr(get(a:b, idx, 0)) let b_element = str2nr(get(a:b, idx, 0))
@ -141,7 +164,7 @@ function! syntastic#util#compareLexi(a, b) " {{{2
return a_element > b_element ? 1 : -1 return a_element > b_element ? 1 : -1
endif endif
endfor endfor
" Everything matched, so it is at least the required version. " still here, thus everything matched
return 0 return 0
endfunction " }}}2 endfunction " }}}2
@ -150,7 +173,7 @@ endfunction " }}}2
let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen') let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
lockvar s:_width lockvar s:_width
function! syntastic#util#screenWidth(str, tabstop) " {{{2 function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
let chunks = split(a:str, "\t", 1) let chunks = split(a:str, "\t", 1)
let width = s:_width(chunks[-1]) let width = s:_width(chunks[-1])
for c in chunks[:-2] for c in chunks[:-2]
@ -161,13 +184,13 @@ function! syntastic#util#screenWidth(str, tabstop) " {{{2
endfunction " }}}2 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) " {{{2 function! syntastic#util#wideMsg(msg) abort " {{{2
let old_ruler = &ruler let old_ruler = &ruler
let old_showcmd = &showcmd let old_showcmd = &showcmd
"This is here because it is possible for some error messages to "This is here because it is possible for some error messages to
"begin with \n which will cause a "press enter" prompt. "begin with \n which will cause a "press enter" prompt.
let msg = substitute(a:msg, "\n", "", "g") let msg = substitute(a:msg, "\n", '', 'g')
"convert tabs to spaces so that the tabs count towards the window "convert tabs to spaces so that the tabs count towards the window
"width as the proper amount of characters "width as the proper amount of characters
@ -185,7 +208,7 @@ function! syntastic#util#wideMsg(msg) " {{{2
endfunction " }}}2 endfunction " }}}2
" Check whether a buffer is loaded, listed, and not hidden " Check whether a buffer is loaded, listed, and not hidden
function! syntastic#util#bufIsActive(buffer) " {{{2 function! syntastic#util#bufIsActive(buffer) abort " {{{2
" convert to number, or hell breaks loose " convert to number, or hell breaks loose
let buf = str2nr(a:buffer) let buf = str2nr(a:buffer)
@ -203,13 +226,15 @@ function! syntastic#util#bufIsActive(buffer) " {{{2
return 0 return 0
endfunction " }}}2 endfunction " }}}2
" start in directory a:where and walk up the parent folders until it " start in directory a:where and walk up the parent folders until it finds a
" finds a file matching a:what; return path to that file " file matching a:what; return path to that file; do NOT use this function if
function! syntastic#util#findInParent(what, where) " {{{2 " a:what doesn't contain wildcards, use findfile(a:what, escape(a:where, ' ') . ';')
" instead
function! syntastic#util#findInParent(what, where) abort " {{{2
let here = fnamemodify(a:where, ':p') let here = fnamemodify(a:where, ':p')
let root = syntastic#util#Slash() let root = syntastic#util#Slash()
if syntastic#util#isRunningWindows() && here[1] == ':' if syntastic#util#isRunningWindows() && here[1] ==# ':'
" The drive letter is an ever-green source of fun. That's because " The drive letter is an ever-green source of fun. That's because
" we don't care about running syntastic on Amiga these days. ;) " we don't care about running syntastic on Amiga these days. ;)
let root = fnamemodify(root, ':p') let root = fnamemodify(root, ':p')
@ -217,7 +242,7 @@ function! syntastic#util#findInParent(what, where) " {{{2
endif endif
let old = '' let old = ''
while here != '' while here !=# ''
let p = split(globpath(here, a:what, 1), '\n') let p = split(globpath(here, a:what, 1), '\n')
if !empty(p) if !empty(p)
@ -237,7 +262,7 @@ function! syntastic#util#findInParent(what, where) " {{{2
endfunction " }}}2 endfunction " }}}2
" Returns unique elements in a list " Returns unique elements in a list
function! syntastic#util#unique(list) " {{{2 function! syntastic#util#unique(list) abort " {{{2
let seen = {} let seen = {}
let uniques = [] let uniques = []
for e in a:list for e in a:list
@ -250,18 +275,18 @@ function! syntastic#util#unique(list) " {{{2
endfunction " }}}2 endfunction " }}}2
" A less noisy shellescape() " A less noisy shellescape()
function! syntastic#util#shescape(string) " {{{2 function! syntastic#util#shescape(string) abort " {{{2
return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string) return a:string =~# '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string)
endfunction " }}}2 endfunction " }}}2
" A less noisy shellescape(expand()) " A less noisy shellescape(expand())
function! syntastic#util#shexpand(string, ...) " {{{2 function! syntastic#util#shexpand(string, ...) abort " {{{2
return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1)) return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1))
endfunction " }}}2 endfunction " }}}2
" Escape arguments " Escape arguments
function! syntastic#util#argsescape(opt) " {{{2 function! syntastic#util#argsescape(opt) abort " {{{2
if type(a:opt) == type('') && a:opt != '' if type(a:opt) == type('') && a:opt !=# ''
return [a:opt] return [a:opt]
elseif type(a:opt) == type([]) elseif type(a:opt) == type([])
return map(copy(a:opt), 'syntastic#util#shescape(v:val)') return map(copy(a:opt), 'syntastic#util#shescape(v:val)')
@ -271,7 +296,7 @@ function! syntastic#util#argsescape(opt) " {{{2
endfunction " }}}2 endfunction " }}}2
" decode XML entities " decode XML entities
function! syntastic#util#decodeXMLEntities(string) " {{{2 function! syntastic#util#decodeXMLEntities(string) abort " {{{2
let str = a:string let str = a:string
let str = substitute(str, '\m&lt;', '<', 'g') let str = substitute(str, '\m&lt;', '<', 'g')
let str = substitute(str, '\m&gt;', '>', 'g') let str = substitute(str, '\m&gt;', '>', 'g')
@ -281,7 +306,7 @@ function! syntastic#util#decodeXMLEntities(string) " {{{2
return str return str
endfunction " }}}2 endfunction " }}}2
function! syntastic#util#redraw(full) " {{{2 function! syntastic#util#redraw(full) abort " {{{2
if a:full if a:full
redraw! redraw!
else else
@ -289,7 +314,7 @@ function! syntastic#util#redraw(full) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! syntastic#util#dictFilter(errors, filter) " {{{2 function! syntastic#util#dictFilter(errors, filter) abort " {{{2
let rules = s:_translateFilter(a:filter) let rules = s:_translateFilter(a:filter)
" call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, "applying filter:", rules) " call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, "applying filter:", rules)
try try
@ -300,18 +325,17 @@ function! syntastic#util#dictFilter(errors, filter) " {{{2
endtry endtry
endfunction " }}}2 endfunction " }}}2
" Return a [high, low] list of integers, representing the time " Return a [seconds, fractions] list of strings, representing the
" (hopefully high resolution) since program start " (hopefully high resolution) time since program start
" TODO: This assumes reltime() returns a list of integers. function! syntastic#util#stamp() abort " {{{2
function! syntastic#util#stamp() " {{{2 return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
return reltime(g:_SYNTASTIC_START)
endfunction " }}}2 endfunction " }}}2
" }}}1 " }}}1
" Private functions {{{1 " Private functions {{{1
function! s:_translateFilter(filters) " {{{2 function! s:_translateFilter(filters) abort " {{{2
let conditions = [] let conditions = []
for k in keys(a:filters) for k in keys(a:filters)
if type(a:filters[k]) == type([]) if type(a:filters[k]) == type([])
@ -322,14 +346,14 @@ function! s:_translateFilter(filters) " {{{2
endfor endfor
if conditions == [] if conditions == []
let conditions = ["1"] let conditions = ['1']
endif endif
return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ') return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
endfunction " }}}2 endfunction " }}}2
function! s:_translateElement(key, term) " {{{2 function! s:_translateElement(key, term) abort " {{{2
let fkey = a:key let fkey = a:key
if fkey[0] == '!' if fkey[0] ==# '!'
let fkey = fkey[1:] let fkey = fkey[1:]
let not = 1 let not = 1
else else
@ -354,18 +378,18 @@ function! s:_translateElement(key, term) " {{{2
let op = not ? ' =~# ' : ' !~# ' let op = not ? ' =~# ' : ' !~# '
let ret = 'bufname(str2nr(v:val["bufnr"]))' let ret = 'bufname(str2nr(v:val["bufnr"]))'
let mod = fkey[4:] let mod = fkey[4:]
if mod != '' if mod !=# ''
let ret = 'fnamemodify(' . ret . ', ' . string(mod) . ')' let ret = 'fnamemodify(' . ret . ', ' . string(mod) . ')'
endif endif
let ret .= op . string(a:term) let ret .= op . string(a:term)
else else
call syntastic#log#warn('quiet_messages: ignoring invalid key ' . strtrans(string(fkey))) call syntastic#log#warn('quiet_messages: ignoring invalid key ' . strtrans(string(fkey)))
let ret = "1" let ret = '1'
endif endif
return ret return ret
endfunction " }}}2 endfunction " }}}2
function! s:_rmrf(what) " {{{2 function! s:_rmrf(what) abort " {{{2
if !exists('s:rmdir') if !exists('s:rmdir')
let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir')) let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir'))
endif endif
@ -378,7 +402,7 @@ function! s:_rmrf(what) " {{{2
for f in split(globpath(a:what, '*', 1), "\n") for f in split(globpath(a:what, '*', 1), "\n")
call s:_rmrf(f) call s:_rmrf(f)
endfor endfor
silent! call system(s:rmdir . ' ' . syntastic#util#shescape(a:what)) silent! call syntastic#util#system(s:rmdir . ' ' . syntastic#util#shescape(a:what))
else else
silent! call delete(a:what) silent! call delete(a:what)
endif endif

@ -39,16 +39,23 @@ CONTENTS *syntastic-contents*
6.Notes........................................|syntastic-notes| 6.Notes........................................|syntastic-notes|
6.1.Handling of composite filetypes........|syntastic-composite| 6.1.Handling of composite filetypes........|syntastic-composite|
6.2.Editing files over network.............|syntastic-netrw| 6.2.Editing files over network.............|syntastic-netrw|
6.3.Interaction with python-mode...........|syntastic-pymode| 6.3.The 'shellslash' option................|syntastic-shellslash|
6.4.Interaction with YouCompleteMe.........|syntastic-ycm| 6.4.Saving Vim sessions....................|syntastic-sessions|
6.5.Interaction with the fish shell........|syntastic-fish| 7.Compatibility with other software............|syntastic-compatibility|
6.6.Interaction with PowerShell............|syntastic-powershell| 7.1.The csh and tcsh shells................|syntastic-csh|
6.7.Using syntastic with the fizsh shell...|syntastic-fizsh| 7.2.Eclim..................................|syntastic-eclim|
6.8.Interaction with Eclim.................|syntastic-eclim| 7.3.The fish shell.........................|syntastic-fish|
6.9.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| 7.4.The fizsh shell........................|syntastic-fizsh|
6.10.Interaction with vim-auto-save........|syntastic-vim-auto-save| 7.5.powerline..............................|syntastic-powerline|
7.About........................................|syntastic-about| 7.6.The PowerShell shell...................|syntastic-powershell|
8.License......................................|syntastic-license| 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|
8.About........................................|syntastic-about|
9.License......................................|syntastic-license|
============================================================================== ==============================================================================
@ -602,6 +609,20 @@ looking at their exit codes. The "cmd.exe" shell on Windows make these checks
meaningless, by returning 1 to Vim when the checkers exit with non-zero codes. meaningless, by returning 1 to Vim when the checkers exit with non-zero codes.
The above variable can be used to disable exit code checks in syntastic. 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
compatible shells are "zsh", "bash", "ksh", and of course the original Bourne
"sh".
This shell is independent of Vim's 'shell', and it isn't used for interactive
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_debug'* *'syntastic_debug'*
Default: 0 Default: 0
Set this to the sum of one or more of the following flags to enable Set this to the sum of one or more of the following flags to enable
@ -782,96 +803,162 @@ of operation. It can only check files that can be accessed directly by local
checkers, without any translation or conversion. checkers, without any translation or conversion.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.3 Interaction with python-mode *syntastic-pymode* 6.3 The 'shellslash' option *syntastic-shellslash*
Syntastic can be used along with the 'python-mode' Vim plugin (see The 'shellslash' option is relevant only on Windows systems. This option
https://github.com/klen/python-mode). However, they both run syntax checks by determines (among other things) the rules for quoting command lines, and there
default when you save buffers to disk, and this is probably not what you want. is no easy way for syntastic to make sure its state is appropriate for your
To avoid both plugins opening error windows, you can either set passive mode shell. It should be turned off if your 'shell' (or |g:syntastic_shell|) is
for python in syntastic (see |syntastic_mode_map|), or disable lint checks in "cmd.exe", and on for shells that expect an UNIX-like syntax, such as Cygwin's
'python-mode', by setting |pymode_lint_write| to 0. E.g.: > "sh". Most checkers will stop working if 'shellslash' is set to the wrong
let g:pymode_lint_write = 0 value.
------------------------------------------------------------------------------
6.4 Saving Vim sessions *syntastic-sessions*
If you use |:mksession| to save Vim sessions you should probably make sure to
remove option "blank" from 'sessionoptions': >
set sessionoptions-=blank
< <
This will prevent |:mksession| from saving |syntastic-error-window| as empty
quickfix windows.
==============================================================================
7. Compatibility with other software *syntastic-compatibility*
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.4 Interaction with YouCompleteMe *syntastic-ycm* 7.1 The csh and tcsh shells *syntastic-csh*
Syntastic can be used together with the 'YouCompleteMe' Vim plugin (see The "csh" and "tcsh" shells are mostly compatible with syntastic. However,
http://valloric.github.io/YouCompleteMe/). However, by default 'YouCompleteMe' some checkers assume Bourne shell syntax for redirecting "stderr". For this
disables syntastic's checkers for the "c", "cpp", "objc", and "objcpp" reason, you should point |g:syntastic_shell| to a Bourne-compatible shell,
filetypes, in order to allow its own checkers to run. If you want to use YCM's such as "zsh", "bash", "ksh", or even the original Bourne "sh": >
identifier completer but still run syntastic's checkers for those filetypes you let g:syntastic_shell = "/bin/sh"
have to set |ycm_show_diagnostics_ui| to 0. E.g.: >
let g:ycm_show_diagnostics_ui = 0
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.5 Interaction with the fish shell *syntastic-fish* 7.2. Eclim *syntastic-eclim*
At the time of this writing the 'fish' shell (see http://fishshell.com/) Syntastic can be used together with "Eclim" (see http://eclim.org/). However,
doesn't support the standard UNIX syntax for file redirections, and thus it by default Eclim disables syntastic's checks for the filetypes it supports, in
can't be used together with syntastic. You don't need to change your login order to run its own validation. If you'd prefer to use Eclim but still run
shell to address this problem, but you do have to point Vim's 'shell' to a more syntastic's checks, set |g:EclimFileTypeValidate| to 0: >
traditional shell, such as "zsh", "bash", "ksh", or even the original Bourne let g:EclimFileTypeValidate = 0
"sh": >
set shell=bash
< <
It is also possible to re-enable syntastic checks only for some filetypes, and
run Eclim's validation for others. Please consult Eclim's documentation for
details.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.6. Interaction with PowerShell *syntastic-powershell* 7.3 The fish shell *syntastic-fish*
At the time of this writing, syntastic is not compatible with using 'Windows At the time of this writing the "fish" shell (see http://fishshell.com/)
PowerShell' (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's doesn't support the standard UNIX syntax for file redirections, and thus it
'shell'. You may still run Vim from 'PowerShell', but you do have to point can't be used together with syntastic. You can however set |g:syntastic_shell|
Vim's 'shell' to a more traditional program, such as 'cmd.exe': > to a more traditional shell, such as "zsh", "bash", "ksh", or even the
set shell=cmd.exe original Bourne "sh": >
let g:syntastic_shell = "/bin/sh"
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.7. Using syntastic with the fizsh shell *syntastic-fizsh* 7.4. The fizsh shell *syntastic-fizsh*
Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh) Using syntastic with the "fizsh" shell (see https://github.com/zsh-users/fizsh)
is possible, but potentially problematic. In order to do it you'll need to set is possible, but potentially problematic. In order to do it you'll need to set
'shellredir' like this: > 'shellredir' like this: >
set shellredir=>%s\ 2>&1 set shellredir=>%s\ 2>&1
< <
Please keep in mind however that Vim can't take advantage of any of the Please keep in mind however that Vim can't take advantage of any of the
interactive features of 'fizsh'. Using a more traditional shell such as "zsh", interactive features of "fizsh". Using a more traditional shell such as "zsh",
"bash", "ksh", or the original Bourne "sh" might be a better choice: > "bash", "ksh", or the original Bourne "sh" might be a better choice: >
set shell=zsh let g:syntastic_shell = "/bin/sh"
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.8. Interaction with Eclim *syntastic-eclim* 7.5. 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
~/.config/powerline/themes/vim/default.json, with a content like this: >
{
"segment_data" : {
"powerline.segments.vim.plugin.syntastic.syntastic" : {
"args" : {
"err_format" : "Err: {first_line} #{num} ",
"warn_format" : "Warn: {first_line} #{num} "
}
}
}
}
<
------------------------------------------------------------------------------
7.6. The PowerShell shell *syntastic-powershell*
Syntastic can be used together with 'Eclim' (see http://eclim.org/). However, At the time of this writing, syntastic is not compatible with using "Windows
by default Eclim disables syntastic's checks for the filetypes it supports, in PowerShell" (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
order to run its own validation. If you'd prefer to use Eclim but still run 'shell'. You may still run Vim from 'PowerShell', but you do have to point
syntastic's checks, set |g:EclimFileTypeValidate| to 0: > Vim's 'shell' to a more traditional program, such as "cmd.exe": >
let g:EclimFileTypeValidate = 0 set shell=cmd.exe
< <
It is also possible to re-enable syntastic checks only for some filetypes, and ------------------------------------------------------------------------------
run Eclim's validation for others. Please consult Eclim's documentation for 7.7 python-mode *syntastic-pymode*
details.
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
<
------------------------------------------------------------------------------
7.8. 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.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.9. Interaction with vim-virtualenv *syntastic-vim-virtualenv* 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.: >
let g:go_fmt_fail_silently = 1
<
------------------------------------------------------------------------------
7.10. vim-virtualenv *syntastic-vim-virtualenv*
At the time of this writing, syntastic can't run checkers installed At the time of this writing, syntastic can't run checkers installed
in Python virtual environments activated by 'vim-virtualenv' (see in Python virtual environments activated by "vim-virtualenv" (see
https://github.com/jmcantrell/vim-virtualenv). This is a limitation of https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
'vim-virtualenv'. "vim-virtualenv".
------------------------------------------------------------------------------
7.11 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.: >
let g:ycm_show_diagnostics_ui = 0
<
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6.10. Interaction with vim-auto-save *syntastic-vim-auto-save* 7.12 The zsh shell and rvm *syntastic-zsh*
At the time of this writing, syntastic checks in active mode are not triggered If you're running MacVim together with the "zsh" shell (http://www.zsh.org/)
by 'vim-auto-save' (see https://github.com/907th/vim-auto-save). The reason is and "rvm" (https://rvm.io/), you need to be aware that MacVim does not source
a limitation in 'vim-auto-save', namely a missing flag to an 'autocmd' (see the .zshrc file, but will source a .zshenv file. Consequently you have to
|autocmd-nested|). Fortunately it's pretty easy to achieve a similar effect either source the "rvm" scripts from within .zshenv, or just set your shell to
without 'vim-auto-save'': > "sh": >
augroup syntastic let g:syntastic_shell = "/bin/sh"
autocmd CursorHold * nested update
augroup END
set updatetime=200
< <
============================================================================== ==============================================================================
7. About *syntastic-about* 8. About *syntastic-about*
The core maintainers of syntastic are: The core maintainers of syntastic are:
Martin Grenfell (GitHub: scrooloose) Martin Grenfell (GitHub: scrooloose)
@ -883,9 +970,9 @@ Find the latest version of syntastic at:
http://github.com/scrooloose/syntastic http://github.com/scrooloose/syntastic
============================================================================== ==============================================================================
8. License *syntastic-license* 9. License *syntastic-license*
Syntastic is released under the wtfpl. Syntastic is released under the WTFPL.
See http://sam.zoy.org/wtfpl/COPYING. See http://sam.zoy.org/wtfpl/COPYING.
vim:tw=78:sw=4:ft=help:norl: vim:tw=78:sw=4:ft=help:norl:

@ -9,7 +9,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_plugin = 1 let g:loaded_syntastic_plugin = 1
@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.6.0-5' let g:_SYNTASTIC_VERSION = '3.6.0-102'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1
@ -34,7 +34,7 @@ for s:feature in [
\ 'user_commands' \ 'user_commands'
\ ] \ ]
if !has(s:feature) if !has(s:feature)
call syntastic#log#error("need Vim compiled with feature " . s:feature) call syntastic#log#error('need Vim compiled with feature ' . s:feature)
finish finish
endif endif
endfor endfor
@ -42,15 +42,25 @@ endfor
let s:_running_windows = syntastic#util#isRunningWindows() let s:_running_windows = syntastic#util#isRunningWindows()
lockvar s:_running_windows lockvar s:_running_windows
if !s:_running_windows && executable('uname') if !exists('g:syntastic_shell')
let g:syntastic_shell = &shell
endif
if s:_running_windows
let g:_SYNTASTIC_UNAME = 'Windows'
elseif executable('uname')
try try
let s:_uname = system('uname') let g:_SYNTASTIC_UNAME = split(syntastic#util#system('uname'), "\n")[0]
catch /\m^Vim\%((\a\+)\)\=:E484/ catch /\m^Vim\%((\a\+)\)\=:E484/
call syntastic#log#error("your shell " . &shell . " can't handle traditional UNIX syntax for redirections") call syntastic#log#error("your shell " . syntastic#util#var('shell') . " can't handle traditional UNIX syntax for redirections")
finish finish
catch /\m^Vim\%((\a\+)\)\=:E684/
let g:_SYNTASTIC_UNAME = 'Unknown'
endtry endtry
lockvar s:_uname else
let g:_SYNTASTIC_UNAME = 'Unknown'
endif endif
lockvar g:_SYNTASTIC_UNAME
" }}}1 " }}}1
@ -61,7 +71,6 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'always_populate_loc_list': 0, \ 'always_populate_loc_list': 0,
\ 'auto_jump': 0, \ 'auto_jump': 0,
\ 'auto_loc_list': 2, \ 'auto_loc_list': 2,
\ 'bash_hack': 0,
\ 'check_on_open': 0, \ 'check_on_open': 0,
\ 'check_on_wq': 1, \ 'check_on_wq': 1,
\ 'cursor_columns': 1, \ 'cursor_columns': 1,
@ -71,7 +80,7 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'enable_highlighting': 1, \ 'enable_highlighting': 1,
\ 'enable_signs': 1, \ 'enable_signs': 1,
\ 'error_symbol': '>>', \ 'error_symbol': '>>',
\ 'exit_checks': !(s:_running_windows && &shell =~? '\m\<cmd\.exe$'), \ 'exit_checks': !(s:_running_windows && syntastic#util#var('shell', &shell) =~? '\m\<cmd\.exe$'),
\ 'filetype_map': {}, \ 'filetype_map': {},
\ 'full_redraws': !(has('gui_running') || has('gui_macvim')), \ 'full_redraws': !(has('gui_running') || has('gui_macvim')),
\ 'id_checkers': 1, \ 'id_checkers': 1,
@ -80,6 +89,7 @@ let g:_SYNTASTIC_DEFAULTS = {
\ 'loc_list_height': 10, \ 'loc_list_height': 10,
\ 'quiet_messages': {}, \ 'quiet_messages': {},
\ 'reuse_loc_lists': 0, \ 'reuse_loc_lists': 0,
\ 'shell': &shell,
\ 'sort_aggregated_errors': 1, \ 'sort_aggregated_errors': 1,
\ 'stl_format': '[Syntax: line:%F (%t)]', \ 'stl_format': '[Syntax: line:%F (%t)]',
\ 'style_error_symbol': 'S>', \ 'style_error_symbol': 'S>',
@ -94,7 +104,7 @@ for s:key in keys(g:_SYNTASTIC_DEFAULTS)
endif endif
endfor endfor
if exists("g:syntastic_quiet_warnings") if exists('g:syntastic_quiet_warnings')
call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead") call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead")
if g:syntastic_quiet_warnings if g:syntastic_quiet_warnings
let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', []) let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', [])
@ -152,7 +162,7 @@ let s:modemap = g:SyntasticModeMap.Instance()
" @vimlint(EVL103, 1, a:cursorPos) " @vimlint(EVL103, 1, a:cursorPos)
" @vimlint(EVL103, 1, a:cmdLine) " @vimlint(EVL103, 1, a:cmdLine)
" @vimlint(EVL103, 1, a:argLead) " @vimlint(EVL103, 1, a:argLead)
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) " {{{2 function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) abort " {{{2
let checker_names = [] let checker_names = []
for ft in s:_resolve_filetypes([]) for ft in s:_resolve_filetypes([])
call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft)) call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft))
@ -167,7 +177,7 @@ endfunction " }}}2
" @vimlint(EVL103, 1, a:cursorPos) " @vimlint(EVL103, 1, a:cursorPos)
" @vimlint(EVL103, 1, a:cmdLine) " @vimlint(EVL103, 1, a:cmdLine)
" @vimlint(EVL103, 1, a:argLead) " @vimlint(EVL103, 1, a:argLead)
function! s:CompleteFiletypes(argLead, cmdLine, cursorPos) " {{{2 function! s:CompleteFiletypes(argLead, cmdLine, cursorPos) abort " {{{2
return join(s:registry.getKnownFiletypes(), "\n") return join(s:registry.getKnownFiletypes(), "\n")
endfunction " }}}2 endfunction " }}}2
" @vimlint(EVL103, 0, a:cursorPos) " @vimlint(EVL103, 0, a:cursorPos)
@ -185,34 +195,34 @@ command! SyntasticSetLoclist call SyntasticSetLoclist()
" Public API {{{1 " Public API {{{1
function! SyntasticCheck(...) " {{{2 function! SyntasticCheck(...) abort " {{{2
call s:UpdateErrors(0, a:000) call s:UpdateErrors(0, a:000)
call syntastic#util#redraw(g:syntastic_full_redraws) call syntastic#util#redraw(g:syntastic_full_redraws)
endfunction " }}}2 endfunction " }}}2
function! SyntasticInfo(...) " {{{2 function! SyntasticInfo(...) abort " {{{2
call s:modemap.modeInfo(a:000) call s:modemap.modeInfo(a:000)
call s:registry.echoInfoFor(s:_resolve_filetypes(a:000)) call s:registry.echoInfoFor(s:_resolve_filetypes(a:000))
call s:_explain_skip(a:000) call s:_explain_skip(a:000)
endfunction " }}}2 endfunction " }}}2
function! SyntasticErrors() " {{{2 function! SyntasticErrors() abort " {{{2
call g:SyntasticLoclist.current().show() call g:SyntasticLoclist.current().show()
endfunction " }}}2 endfunction " }}}2
function! SyntasticReset() " {{{2 function! SyntasticReset() abort " {{{2
call s:ClearCache() call s:ClearCache()
call s:notifiers.refresh(g:SyntasticLoclist.New([])) call s:notifiers.refresh(g:SyntasticLoclist.New([]))
endfunction " }}}2 endfunction " }}}2
function! SyntasticToggleMode() " {{{2 function! SyntasticToggleMode() abort " {{{2
call s:modemap.toggleMode() call s:modemap.toggleMode()
call s:ClearCache() call s:ClearCache()
call s:notifiers.refresh(g:SyntasticLoclist.New([])) call s:notifiers.refresh(g:SyntasticLoclist.New([]))
call s:modemap.echoMode() call s:modemap.echoMode()
endfunction " }}}2 endfunction " }}}2
function! SyntasticSetLoclist() " {{{2 function! SyntasticSetLoclist() abort " {{{2
call g:SyntasticLoclist.current().setloclist() call g:SyntasticLoclist.current().setloclist()
endfunction " }}}2 endfunction " }}}2
@ -233,32 +243,32 @@ if v:version > 703 || (v:version == 703 && has('patch544'))
augroup END augroup END
endif endif
function! s:BufReadPostHook() " {{{2 function! s:BufReadPostHook() abort " {{{2
if g:syntastic_check_on_open if g:syntastic_check_on_open
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) \ 'autocmd: BufReadPost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
call s:UpdateErrors(1, []) call s:UpdateErrors(1, [])
endif endif
endfunction " }}}2 endfunction " }}}2
function! s:BufWritePostHook() " {{{2 function! s:BufWritePostHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) \ 'autocmd: BufWritePost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
call s:UpdateErrors(1, []) call s:UpdateErrors(1, [])
endfunction " }}}2 endfunction " }}}2
function! s:BufEnterHook() " {{{2 function! s:BufEnterHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . \ 'autocmd: BufEnter, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))) .
\ ', &buftype = ' . string(&buftype)) \ ', &buftype = ' . string(&buftype))
if &buftype == '' if &buftype ==# ''
call s:notifiers.refresh(g:SyntasticLoclist.current()) call s:notifiers.refresh(g:SyntasticLoclist.current())
elseif &buftype == 'quickfix' elseif &buftype ==# 'quickfix'
" TODO: this is needed because in recent versions of Vim lclose " TODO: this is needed because in recent versions of Vim lclose
" can no longer be called from BufWinLeave " can no longer be called from BufWinLeave
" TODO: at this point there is no b:syntastic_loclist " TODO: at this point there is no b:syntastic_loclist
let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1') let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1')
let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer')) let owner = str2nr(getbufvar(bufnr(''), 'syntastic_owner_buffer'))
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : [])) let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
if get(w:, 'syntastic_loclist_set', 0) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) if get(w:, 'syntastic_loclist_set', 0) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
call SyntasticLoclistHide() call SyntasticLoclistHide()
@ -266,9 +276,9 @@ function! s:BufEnterHook() " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! s:QuitPreHook() " {{{2 function! s:QuitPreHook() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) \ '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') let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
if get(w:, 'syntastic_loclist_set', 0) if get(w:, 'syntastic_loclist_set', 0)
call SyntasticLoclistHide() call SyntasticLoclistHide()
@ -280,7 +290,7 @@ endfunction " }}}2
" Main {{{1 " Main {{{1
"refresh and redraw all the error info for this buf when saving or reading "refresh and redraw all the error info for this buf when saving or reading
function! s:UpdateErrors(auto_invoked, checker_names) " {{{2 function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'version') call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'version')
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS) call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS)
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES) call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
@ -294,6 +304,9 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking() let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
if run_checks if run_checks
call s:CacheErrors(a:checker_names) call s:CacheErrors(a:checker_names)
unlockvar! b:syntastic_changedtick
let b:syntastic_changedtick = b:changedtick
lockvar! b:syntastic_changedtick
endif endif
let loclist = g:SyntasticLoclist.current() let loclist = g:SyntasticLoclist.current()
@ -325,7 +338,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
" order, which can lead to missing filetype when jumping " order, which can lead to missing filetype when jumping
" to a new file; the following is a workaround for the " to a new file; the following is a workaround for the
" resulting brain damage " resulting brain damage
if &filetype == '' if &filetype ==# ''
silent! filetype detect silent! filetype detect
endif endif
endif endif
@ -336,13 +349,13 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
endfunction " }}}2 endfunction " }}}2
"clear the loc list for the buffer "clear the loc list for the buffer
function! s:ClearCache() " {{{2 function! s:ClearCache() abort " {{{2
call s:notifiers.reset(g:SyntasticLoclist.current()) call s:notifiers.reset(g:SyntasticLoclist.current())
call b:syntastic_loclist.destroy() call b:syntastic_loclist.destroy()
endfunction " }}}2 endfunction " }}}2
"detect and cache all syntax errors in this buffer "detect and cache all syntax errors in this buffer
function! s:CacheErrors(checker_names) " {{{2 function! s:CacheErrors(checker_names) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: ' . call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: ' .
\ (len(a:checker_names) ? join(a:checker_names) : 'default checkers')) \ (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
call s:ClearCache() call s:ClearCache()
@ -351,7 +364,8 @@ function! s:CacheErrors(checker_names) " {{{2
if !s:_skip_file() if !s:_skip_file()
" debug logging {{{3 " debug logging {{{3
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'aggregate_errors') call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'aggregate_errors')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . getcwd()) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$PATH = ' . string($PATH))
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd()))
" }}}3 " }}}3
let filetypes = s:_resolve_filetypes([]) let filetypes = s:_resolve_filetypes([])
@ -452,20 +466,15 @@ endfunction " }}}2
" 'env' - environment variables to set before running the checker " 'env' - environment variables to set before running the checker
" 'returns' - a list of valid exit codes for the checker " 'returns' - a list of valid exit codes for the checker
" @vimlint(EVL102, 1, l:env_save) " @vimlint(EVL102, 1, l:env_save)
function! SyntasticMake(options) " {{{2 function! SyntasticMake(options) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'SyntasticMake: called with options:', a:options) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'SyntasticMake: called with options:', a:options)
" save options and locale env variables {{{3 " save options and locale env variables {{{3
let old_shellredir = &shellredir
let old_local_errorformat = &l:errorformat let old_local_errorformat = &l:errorformat
let old_errorformat = &errorformat let old_errorformat = &errorformat
let old_cwd = getcwd() let old_cwd = getcwd()
let old_lc_messages = $LC_MESSAGES
let old_lc_all = $LC_ALL
" }}}3 " }}}3
call s:_bash_hack()
if has_key(a:options, 'errorformat') if has_key(a:options, 'errorformat')
let &errorformat = a:options['errorformat'] let &errorformat = a:options['errorformat']
endif endif
@ -479,23 +488,19 @@ function! SyntasticMake(options) " {{{2
if has_key(a:options, 'env') && len(a:options['env']) if has_key(a:options, 'env') && len(a:options['env'])
for key in keys(a:options['env']) for key in keys(a:options['env'])
if key =~? '\m^[a-z_]\+$' if key =~? '\m^[a-z_]\+$'
exec 'let env_save[' . string(key) . '] = $' . key execute 'let env_save[' . string(key) . '] = $' . key
exec 'let $' . key . ' = ' . string(a:options['env'][key]) execute 'let $' . key . ' = ' . string(a:options['env'][key])
endif endif
endfor endfor
endif endif
let $LC_MESSAGES = 'C'
let $LC_ALL = ''
" }}}3 " }}}3
let err_lines = split(system(a:options['makeprg']), "\n", 1) let err_lines = split(syntastic#util#system(a:options['makeprg']), "\n", 1)
" restore environment variables {{{3 " restore environment variables {{{3
let $LC_ALL = old_lc_all
let $LC_MESSAGES = old_lc_messages
if len(env_save) if len(env_save)
for key in keys(env_save) for key in keys(env_save)
exec 'let $' . key . ' = ' . string(env_save[key]) execute 'let $' . key . ' = ' . string(env_save[key])
endfor endfor
endif endif
" }}}3 " }}}3
@ -540,10 +545,9 @@ function! SyntasticMake(options) " {{{2
" restore options {{{3 " restore options {{{3
let &errorformat = old_errorformat let &errorformat = old_errorformat
let &l:errorformat = old_local_errorformat let &l:errorformat = old_local_errorformat
let &shellredir = old_shellredir
" }}}3 " }}}3
if !s:_running_windows && (s:_os_name() =~ "FreeBSD" || s:_os_name() =~ "OpenBSD") if !s:_running_windows && (s:_os_name() =~? 'FreeBSD' || s:_os_name() =~? 'OpenBSD')
call syntastic#util#redraw(g:syntastic_full_redraws) call syntastic#util#redraw(g:syntastic_full_redraws)
endif endif
@ -582,7 +586,7 @@ endfunction " }}}2
"g:syntastic_stl_format "g:syntastic_stl_format
" "
"return '' if no errors are cached for the buffer "return '' if no errors are cached for the buffer
function! SyntasticStatuslineFlag() " {{{2 function! SyntasticStatuslineFlag() abort " {{{2
return g:SyntasticLoclist.current().getStatuslineFlag() return g:SyntasticLoclist.current().getStatuslineFlag()
endfunction " }}}2 endfunction " }}}2
@ -590,12 +594,12 @@ endfunction " }}}2
" Utilities {{{1 " Utilities {{{1
function! s:_resolve_filetypes(filetypes) " {{{2 function! s:_resolve_filetypes(filetypes) abort " {{{2
let type = len(a:filetypes) ? a:filetypes[0] : &filetype let type = len(a:filetypes) ? a:filetypes[0] : &filetype
return split( get(g:syntastic_filetype_map, type, type), '\m\.' ) return split( get(g:syntastic_filetype_map, type, type), '\m\.' )
endfunction " }}}2 endfunction " }}}2
function! s:_ignore_file(filename) " {{{2 function! s:_ignore_file(filename) abort " {{{2
let fname = fnamemodify(a:filename, ':p') let fname = fnamemodify(a:filename, ':p')
for pattern in g:syntastic_ignore_files for pattern in g:syntastic_ignore_files
if fname =~# pattern if fname =~# pattern
@ -606,9 +610,9 @@ function! s:_ignore_file(filename) " {{{2
endfunction " }}}2 endfunction " }}}2
" Skip running in special buffers " Skip running in special buffers
function! s:_skip_file() " {{{2 function! s:_skip_file() abort " {{{2
let fname = expand('%', 1) let fname = expand('%', 1)
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype != '') || let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype !=# '') ||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) || \ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) ||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions \ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
if skip if skip
@ -618,7 +622,7 @@ function! s:_skip_file() " {{{2
endfunction " }}}2 endfunction " }}}2
" Explain why checks will be skipped for the current file " Explain why checks will be skipped for the current file
function! s:_explain_skip(filetypes) " {{{2 function! s:_explain_skip(filetypes) abort " {{{2
if empty(a:filetypes) && s:_skip_file() if empty(a:filetypes) && s:_skip_file()
let why = [] let why = []
let fname = expand('%', 1) let fname = expand('%', 1)
@ -626,7 +630,7 @@ function! s:_explain_skip(filetypes) " {{{2
if get(b:, 'syntastic_skip_checks', 0) if get(b:, 'syntastic_skip_checks', 0)
call add(why, 'b:syntastic_skip_checks set') call add(why, 'b:syntastic_skip_checks set')
endif endif
if &buftype != '' if &buftype !=# ''
call add(why, 'buftype = ' . string(&buftype)) call add(why, 'buftype = ' . string(&buftype))
endif endif
if !filereadable(fname) if !filereadable(fname)
@ -647,7 +651,7 @@ function! s:_explain_skip(filetypes) " {{{2
endfunction " }}}2 endfunction " }}}2
" Take a list of errors and add default values to them from a:options " Take a list of errors and add default values to them from a:options
function! s:_add_to_errors(errors, options) " {{{2 function! s:_add_to_errors(errors, options) abort " {{{2
for err in a:errors for err in a:errors
for key in keys(a:options) for key in keys(a:options)
if !has_key(err, key) || empty(err[key]) if !has_key(err, key) || empty(err[key])
@ -659,30 +663,8 @@ function! s:_add_to_errors(errors, options) " {{{2
return a:errors return a:errors
endfunction " }}}2 endfunction " }}}2
" XXX: Is this still needed? function! s:_os_name() abort " {{{2
" The script changes &shellredir to stop the screen return g:_SYNTASTIC_UNAME
" flicking when shelling out to syntax checkers.
function! s:_bash_hack() " {{{2
if g:syntastic_bash_hack
if !exists('s:shell_is_bash')
let s:shell_is_bash =
\ !s:_running_windows &&
\ (s:_os_name() !~# "FreeBSD") && (s:_os_name() !~# "OpenBSD") &&
\ &shell =~# '\m\<bash$'
endif
if s:shell_is_bash
let &shellredir = '&>'
endif
endif
endfunction " }}}2
function! s:_os_name() " {{{2
if !exists('s:_uname')
let s:_uname = system('uname')
lockvar s:_uname
endif
return s:_uname
endfunction " }}}2 endfunction " }}}2
" }}}1 " }}}1

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_autoloclist") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_notifier_autoloclist') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_notifier_autoloclist = 1 let g:loaded_syntastic_notifier_autoloclist = 1
@ -7,17 +7,17 @@ let g:SyntasticAutoloclistNotifier = {}
" Public methods {{{1 " Public methods {{{1
" "
function! g:SyntasticAutoloclistNotifier.New() " {{{2 function! g:SyntasticAutoloclistNotifier.New() abort " {{{2
let newObj = copy(self) let newObj = copy(self)
return newObj return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.refresh(loclist) " {{{2 function! g:SyntasticAutoloclistNotifier.refresh(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: refresh') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: refresh')
call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist) call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) " {{{2 function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
if !a:loclist.isEmpty() if !a:loclist.isEmpty()
if syntastic#util#var('auto_loc_list') == 1 if syntastic#util#var('auto_loc_list') == 1

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_balloons") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_notifier_balloons') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_notifier_balloons = 1 let g:loaded_syntastic_notifier_balloons = 1
@ -11,17 +11,17 @@ let g:SyntasticBalloonsNotifier = {}
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticBalloonsNotifier.New() " {{{2 function! g:SyntasticBalloonsNotifier.New() abort " {{{2
let newObj = copy(self) let newObj = copy(self)
return newObj return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticBalloonsNotifier.enabled() " {{{2 function! g:SyntasticBalloonsNotifier.enabled() abort " {{{2
return has('balloon_eval') && syntastic#util#var('enable_balloons') return has('balloon_eval') && syntastic#util#var('enable_balloons')
endfunction " }}}2 endfunction " }}}2
" Update the error balloons " Update the error balloons
function! g:SyntasticBalloonsNotifier.refresh(loclist) " {{{2 function! g:SyntasticBalloonsNotifier.refresh(loclist) abort " {{{2
unlet! b:syntastic_private_balloons unlet! b:syntastic_private_balloons
if self.enabled() && !a:loclist.isEmpty() if self.enabled() && !a:loclist.isEmpty()
let b:syntastic_private_balloons = a:loclist.balloons() let b:syntastic_private_balloons = a:loclist.balloons()
@ -33,7 +33,7 @@ endfunction " }}}2
" Reset the error balloons " Reset the error balloons
" @vimlint(EVL103, 1, a:loclist) " @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2 function! g:SyntasticBalloonsNotifier.reset(loclist) abort " {{{2
let b:syntastic_private_balloons = {} let b:syntastic_private_balloons = {}
if has('balloon_eval') if has('balloon_eval')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'balloons: reset') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'balloons: reset')
@ -47,7 +47,7 @@ endfunction " }}}2
" Private functions {{{1 " Private functions {{{1
function! SyntasticBalloonsExprNotifier() " {{{2 function! SyntasticBalloonsExprNotifier() abort " {{{2
if !exists('b:syntastic_private_balloons') if !exists('b:syntastic_private_balloons')
return '' return ''
endif endif

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_checker") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_checker') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_checker = 1 let g:loaded_syntastic_checker = 1
@ -7,7 +7,7 @@ let g:SyntasticChecker = {}
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticChecker.New(args) " {{{2 function! g:SyntasticChecker.New(args) abort " {{{2
let newObj = copy(self) let newObj = copy(self)
let newObj._filetype = a:args['filetype'] let newObj._filetype = a:args['filetype']
@ -40,32 +40,56 @@ function! g:SyntasticChecker.New(args) " {{{2
return newObj return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.getFiletype() " {{{2 function! g:SyntasticChecker.getFiletype() abort " {{{2
return self._filetype return self._filetype
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.getName() " {{{2 function! g:SyntasticChecker.getName() abort " {{{2
return self._name return self._name
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.getExec() " {{{2 " Synchronise _exec with user's setting. Force re-validation if needed.
return "
" XXX: This function must be called at least once before calling either
" 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
let user_exec =
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec : \ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec', self._exec), 1 ) \ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
if user_exec !=# '' && user_exec !=# self._exec
let self._exec = user_exec
if has_key(self, '_available')
" we have a new _exec on the block, it has to be validated
call remove(self, '_available')
endif
endif
endfunction " }}}2
function! g:SyntasticChecker.getExec() abort " {{{2
return self._exec
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.getExecEscaped() " {{{2 function! g:SyntasticChecker.getExecEscaped() abort " {{{2
return syntastic#util#shescape(self.getExec()) return syntastic#util#shescape(self._exec)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.getLocListRaw() " {{{2 function! g:SyntasticChecker.getLocListRaw() abort " {{{2
let name = self._filetype . '/' . self._name let name = self._filetype . '/' . self._name
try try
let list = self._locListFunc() let list = self._locListFunc()
if self._exec !=# ''
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' returned ' . v:shell_error) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
endif
catch /\m\C^Syntastic: checker error$/ catch /\m\C^Syntastic: checker error$/
let list = [] let list = []
if self._exec !=# ''
call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error) call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error)
else
call syntastic#log#error('checker ' . name . ' aborted')
endif
endtry endtry
call self._populateHighlightRegexes(list) call self._populateHighlightRegexes(list)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, name . ' raw:', list) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, name . ' raw:', list)
@ -73,16 +97,15 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2
return list return list
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.getLocList() " {{{2 function! g:SyntasticChecker.getLocList() abort " {{{2
return g:SyntasticLoclist.New(self.getLocListRaw()) return g:SyntasticLoclist.New(self.getLocListRaw())
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.getVersion(...) " {{{2 function! g:SyntasticChecker.getVersion(...) abort " {{{2
if !exists('self._version') if !exists('self._version')
let command = a:0 ? a:1 : self.getExecEscaped() . ' --version' let command = a:0 ? a:1 : self.getExecEscaped() . ' --version'
let version_output = system(command) let version_output = syntastic#util#system(command)
call syntastic#log#debug( g:_SYNTASTIC_DEBUG_CHECKERS, call self.log('getVersion: ' . string(command) . ': ' .
\ self._filetype . '/' . self._name . ': output of ' . string(command) . ': ' .
\ string(split(version_output, "\n", 1)) . \ string(split(version_output, "\n", 1)) .
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') ) \ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') )
call self.setVersion(syntastic#util#parseVersion(version_output)) call self.setVersion(syntastic#util#parseVersion(version_output))
@ -90,7 +113,7 @@ function! g:SyntasticChecker.getVersion(...) " {{{2
return get(self, '_version', []) return get(self, '_version', [])
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.setVersion(version) " {{{2 function! g:SyntasticChecker.setVersion(version) abort " {{{2
if len(a:version) if len(a:version)
let self._version = copy(a:version) let self._version = copy(a:version)
call self.log(self.getExec() . ' version =', a:version) call self.log(self.getExec() . ' version =', a:version)
@ -99,7 +122,7 @@ function! g:SyntasticChecker.setVersion(version) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.log(msg, ...) " {{{2 function! g:SyntasticChecker.log(msg, ...) abort " {{{2
let leader = self._filetype . '/' . self._name . ': ' let leader = self._filetype . '/' . self._name . ': '
if a:0 > 0 if a:0 > 0
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg, a:1) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg, a:1)
@ -108,7 +131,7 @@ function! g:SyntasticChecker.log(msg, ...) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.makeprgBuild(opts) " {{{2 function! g:SyntasticChecker.makeprgBuild(opts) abort " {{{2
let basename = self._filetype . '_' . self._name . '_' let basename = self._filetype . '_' . self._name . '_'
let parts = [] let parts = []
@ -121,20 +144,21 @@ function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
return join(parts) return join(parts)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.isAvailable() " {{{2 function! g:SyntasticChecker.isAvailable() abort " {{{2
call self.syncExec()
if !has_key(self, '_available') if !has_key(self, '_available')
let self._available = self._isAvailableFunc() let self._available = self._isAvailableFunc()
endif endif
return self._available return self._available
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker.wantSort() " {{{2 function! g:SyntasticChecker.wantSort() abort " {{{2
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0) return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
endfunction " }}}2 endfunction " }}}2
" This method is no longer used by syntastic. It's here only to maintain " This method is no longer used by syntastic. It's here only to maintain
" backwards compatibility with external checkers which might depend on it. " backwards compatibility with external checkers which might depend on it.
function! g:SyntasticChecker.setWantSort(val) " {{{2 function! g:SyntasticChecker.setWantSort(val) abort " {{{2
if !exists('g:syntastic_' . self._filetype . '_' . self._name . '_sort') if !exists('g:syntastic_' . self._filetype . '_' . self._name . '_sort')
let g:syntastic_{self._filetype}_{self._name}_sort = a:val let g:syntastic_{self._filetype}_{self._name}_sort = a:val
endif endif
@ -144,7 +168,7 @@ endfunction " }}}2
" Private methods {{{1 " Private methods {{{1
function! g:SyntasticChecker._quietMessages(errors) " {{{2 function! g:SyntasticChecker._quietMessages(errors) abort " {{{2
" wildcard quiet_messages " wildcard quiet_messages
let quiet_filters = copy(syntastic#util#var('quiet_messages', {})) let quiet_filters = copy(syntastic#util#var('quiet_messages', {}))
if type(quiet_filters) != type({}) if type(quiet_filters) != type({})
@ -169,12 +193,12 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2 function! g:SyntasticChecker._populateHighlightRegexes(errors) abort " {{{2
if has_key(self, '_highlightRegexFunc') if has_key(self, '_highlightRegexFunc')
for e in a:errors for e in a:errors
if e['valid'] if e['valid']
let term = self._highlightRegexFunc(e) let term = self._highlightRegexFunc(e)
if term != '' if term !=# ''
let e['hl'] = term let e['hl'] = term
endif endif
endif endif
@ -182,7 +206,7 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticChecker._getOpt(opts, basename, name, default) " {{{2 function! g:SyntasticChecker._getOpt(opts, basename, name, default) abort " {{{2
let ret = [] let ret = []
call extend( ret, syntastic#util#argsescape(get(a:opts, a:name . '_before', '')) ) call extend( ret, syntastic#util#argsescape(get(a:opts, a:name . '_before', '')) )
call extend( ret, syntastic#util#argsescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) ) call extend( ret, syntastic#util#argsescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) )

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_cursor") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_notifier_cursor') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_notifier_cursor = 1 let g:loaded_syntastic_notifier_cursor = 1
@ -7,16 +7,16 @@ let g:SyntasticCursorNotifier = {}
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticCursorNotifier.New() " {{{2 function! g:SyntasticCursorNotifier.New() abort " {{{2
let newObj = copy(self) let newObj = copy(self)
return newObj return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticCursorNotifier.enabled() " {{{2 function! g:SyntasticCursorNotifier.enabled() abort " {{{2
return syntastic#util#var('echo_current_error') return syntastic#util#var('echo_current_error')
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2 function! g:SyntasticCursorNotifier.refresh(loclist) abort " {{{2
if self.enabled() && !a:loclist.isEmpty() if self.enabled() && !a:loclist.isEmpty()
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: refresh') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: refresh')
let b:syntastic_private_messages = copy(a:loclist.messages(bufnr(''))) let b:syntastic_private_messages = copy(a:loclist.messages(bufnr('')))
@ -28,7 +28,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
endfunction " }}}2 endfunction " }}}2
" @vimlint(EVL103, 1, a:loclist) " @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticCursorNotifier.reset(loclist) " {{{2 function! g:SyntasticCursorNotifier.reset(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: reset') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: reset')
autocmd! syntastic CursorMoved autocmd! syntastic CursorMoved
unlet! b:syntastic_private_messages unlet! b:syntastic_private_messages
@ -40,7 +40,7 @@ endfunction " }}}2
" Private functions {{{1 " Private functions {{{1
function! SyntasticRefreshCursor() " {{{2 function! SyntasticRefreshCursor() abort " {{{2
if !exists('b:syntastic_private_messages') || empty(b:syntastic_private_messages) if !exists('b:syntastic_private_messages') || empty(b:syntastic_private_messages)
" file not checked " file not checked
return return
@ -93,7 +93,7 @@ endfunction " }}}2
" Utilities {{{1 " Utilities {{{1
function! s:_is_same_index(line, old_line, column, idx, messages) " {{{2 function! s:_is_same_index(line, old_line, column, idx, messages) abort " {{{2
if a:old_line >= 0 && a:line == a:old_line && a:idx >= 0 if a:old_line >= 0 && a:line == a:old_line && a:idx >= 0
if len(a:messages) <= 1 if len(a:messages) <= 1
return 1 return 1
@ -113,7 +113,7 @@ function! s:_is_same_index(line, old_line, column, idx, messages) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! s:_find_index(column, messages) " {{{2 function! s:_find_index(column, messages) abort " {{{2
let max = len(a:messages) - 1 let max = len(a:messages) - 1
if max == 0 if max == 0
return 0 return 0

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_highlighting") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_notifier_highlighting') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_notifier_highlighting = 1 let g:loaded_syntastic_notifier_highlighting = 1
@ -13,7 +13,7 @@ let s:setup_done = 0
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticHighlightingNotifier.New() " {{{2 function! g:SyntasticHighlightingNotifier.New() abort " {{{2
let newObj = copy(self) let newObj = copy(self)
if !s:setup_done if !s:setup_done
@ -25,12 +25,12 @@ function! g:SyntasticHighlightingNotifier.New() " {{{2
return newObj return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticHighlightingNotifier.enabled() " {{{2 function! g:SyntasticHighlightingNotifier.enabled() abort " {{{2
return s:has_highlighting && syntastic#util#var('enable_highlighting') return s:has_highlighting && syntastic#util#var('enable_highlighting')
endfunction " }}}2 endfunction " }}}2
" Sets error highlights in the cuirrent window " Sets error highlights in the current window
function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2 function! g:SyntasticHighlightingNotifier.refresh(loclist) abort " {{{2
if self.enabled() if self.enabled()
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh')
call self._reset() call self._reset()
@ -61,7 +61,7 @@ endfunction " }}}2
" Remove all error highlights from the window " Remove all error highlights from the window
" @vimlint(EVL103, 1, a:loclist) " @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticHighlightingNotifier.reset(loclist) " {{{2 function! g:SyntasticHighlightingNotifier.reset(loclist) abort " {{{2
if s:has_highlighting if s:has_highlighting
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: reset') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: reset')
call self._reset() call self._reset()
@ -74,7 +74,7 @@ endfunction " }}}2
" Private methods {{{1 " Private methods {{{1
" One time setup: define our own highlighting " One time setup: define our own highlighting
function! g:SyntasticHighlightingNotifier._setup() " {{{2 function! g:SyntasticHighlightingNotifier._setup() abort " {{{2
if s:has_highlighting if s:has_highlighting
if !hlexists('SyntasticError') if !hlexists('SyntasticError')
highlight link SyntasticError SpellBad highlight link SyntasticError SpellBad
@ -91,7 +91,7 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticHighlightingNotifier._reset() " {{{2 function! g:SyntasticHighlightingNotifier._reset() abort " {{{2
for match in getmatches() for match in getmatches()
if stridx(match['group'], 'Syntastic') == 0 if stridx(match['group'], 'Syntastic') == 0
call matchdelete(match['id']) call matchdelete(match['id'])

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_loclist") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_loclist') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_loclist = 1 let g:loaded_syntastic_loclist = 1
@ -7,13 +7,13 @@ let g:SyntasticLoclist = {}
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticLoclist.New(rawLoclist) " {{{2 function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
let newObj = copy(self) let newObj = copy(self)
let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1') let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1')
for e in llist for e in llist
if get(e, 'type', '') == '' if get(e, 'type', '') ==# ''
let e['type'] = 'E' let e['type'] = 'E'
endif endif
endfor endfor
@ -27,20 +27,20 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2
return newObj return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.current() " {{{2 function! g:SyntasticLoclist.current() abort " {{{2
if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist) if !exists('b:syntastic_loclist') || empty(b:syntastic_loclist)
let b:syntastic_loclist = g:SyntasticLoclist.New([]) let b:syntastic_loclist = g:SyntasticLoclist.New([])
endif endif
return b:syntastic_loclist return b:syntastic_loclist
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.extend(other) " {{{2 function! g:SyntasticLoclist.extend(other) abort " {{{2
let list = self.copyRaw() let list = self.copyRaw()
call extend(list, a:other.copyRaw()) call extend(list, a:other.copyRaw())
return g:SyntasticLoclist.New(list) return g:SyntasticLoclist.New(list)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.sort() " {{{2 function! g:SyntasticLoclist.sort() abort " {{{2
if !self._sorted if !self._sorted
for e in self._rawLoclist for e in self._rawLoclist
call s:_set_screen_column(e) call s:_set_screen_column(e)
@ -52,39 +52,39 @@ function! g:SyntasticLoclist.sort() " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.isEmpty() " {{{2 function! g:SyntasticLoclist.isEmpty() abort " {{{2
return empty(self._rawLoclist) return empty(self._rawLoclist)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2 function! g:SyntasticLoclist.isNewerThan(stamp) abort " {{{2
if !exists("self._stamp") if !exists('self._stamp')
let self._stamp = [] let self._stamp = []
return 0 return 0
endif endif
return syntastic#util#compareLexi(self._stamp, a:stamp) > 0 return syntastic#util#compareLexi(self._stamp, a:stamp) > 0
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.copyRaw() " {{{2 function! g:SyntasticLoclist.copyRaw() abort " {{{2
return copy(self._rawLoclist) return copy(self._rawLoclist)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.getRaw() " {{{2 function! g:SyntasticLoclist.getRaw() abort " {{{2
return self._rawLoclist return self._rawLoclist
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.getBuffers() " {{{2 function! g:SyntasticLoclist.getBuffers() abort " {{{2
return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner]) return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner])
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.getCursorColumns() " {{{2 function! g:SyntasticLoclist.getCursorColumns() abort " {{{2
return self._columns return self._columns
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.getStatuslineFlag() " {{{2 function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
if !exists("self._stl_format") if !exists('self._stl_format')
let self._stl_format = '' let self._stl_format = ''
endif endif
if !exists("self._stl_flag") if !exists('self._stl_flag')
let self._stl_flag = '' let self._stl_flag = ''
endif endif
@ -133,7 +133,7 @@ function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
return self._stl_flag return self._stl_flag
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.getFirstError(...) " {{{2 function! g:SyntasticLoclist.getFirstError(...) abort " {{{2
let max_issues = len(self._rawLoclist) let max_issues = len(self._rawLoclist)
if a:0 && a:1 < max_issues if a:0 && a:1 < max_issues
let max_issues = a:1 let max_issues = a:1
@ -148,23 +148,23 @@ function! g:SyntasticLoclist.getFirstError(...) " {{{2
return 0 return 0
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.getName() " {{{2 function! g:SyntasticLoclist.getName() abort " {{{2
return len(self._name) return len(self._name)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.setName(name) " {{{2 function! g:SyntasticLoclist.setName(name) abort " {{{2
let self._name = a:name let self._name = a:name
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.getOwner() " {{{2 function! g:SyntasticLoclist.getOwner() abort " {{{2
return self._owner return self._owner
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.setOwner(buffer) " {{{2 function! g:SyntasticLoclist.setOwner(buffer) abort " {{{2
let self._owner = type(a:buffer) == type(0) ? a:buffer : str2nr(a:buffer) let self._owner = type(a:buffer) == type(0) ? a:buffer : str2nr(a:buffer)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.deploy() " {{{2 function! g:SyntasticLoclist.deploy() abort " {{{2
call self.setOwner(bufnr('')) call self.setOwner(bufnr(''))
let self._stamp = syntastic#util#stamp() let self._stamp = syntastic#util#stamp()
for buf in self.getBuffers() for buf in self.getBuffers()
@ -172,21 +172,21 @@ function! g:SyntasticLoclist.deploy() " {{{2
endfor endfor
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.destroy() " {{{2 function! g:SyntasticLoclist.destroy() abort " {{{2
for buf in self.getBuffers() for buf in self.getBuffers()
call setbufvar(buf, 'syntastic_loclist', {}) call setbufvar(buf, 'syntastic_loclist', {})
endfor endfor
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.decorate(tag) " {{{2 function! g:SyntasticLoclist.decorate(tag) abort " {{{2
for e in self._rawLoclist for e in self._rawLoclist
let e['text'] .= ' [' . a:tag . ']' let e['text'] .= ' [' . a:tag . ']'
endfor endfor
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.balloons() " {{{2 function! g:SyntasticLoclist.balloons() abort " {{{2
if !exists("self._cachedBalloons") if !exists('self._cachedBalloons')
let sep = has("balloon_multiline") ? "\n" : ' | ' let sep = has('balloon_multiline') ? "\n" : ' | '
let self._cachedBalloons = {} let self._cachedBalloons = {}
for e in self._rawLoclist for e in self._rawLoclist
@ -207,29 +207,29 @@ function! g:SyntasticLoclist.balloons() " {{{2
return get(self._cachedBalloons, bufnr(''), {}) return get(self._cachedBalloons, bufnr(''), {})
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.errors() " {{{2 function! g:SyntasticLoclist.errors() abort " {{{2
if !exists("self._cachedErrors") if !exists('self._cachedErrors')
let self._cachedErrors = self.filter({'type': "E"}) let self._cachedErrors = self.filter({'type': 'E'})
endif endif
return self._cachedErrors return self._cachedErrors
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.warnings() " {{{2 function! g:SyntasticLoclist.warnings() abort " {{{2
if !exists("self._cachedWarnings") if !exists('self._cachedWarnings')
let self._cachedWarnings = self.filter({'type': "W"}) let self._cachedWarnings = self.filter({'type': 'W'})
endif endif
return self._cachedWarnings return self._cachedWarnings
endfunction " }}}2 endfunction " }}}2
" Legacy function. Syntastic no longer calls it, but we keep it " Legacy function. Syntastic no longer calls it, but we keep it
" around because other plugins (f.i. powerline) depend on it. " around because other plugins (f.i. powerline) depend on it.
function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() " {{{2 function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() abort " {{{2
return !self.isEmpty() return !self.isEmpty()
endfunction " }}}2 endfunction " }}}2
" cache used by EchoCurrentError() " cache used by EchoCurrentError()
function! g:SyntasticLoclist.messages(buf) " {{{2 function! g:SyntasticLoclist.messages(buf) abort " {{{2
if !exists("self._cachedMessages") if !exists('self._cachedMessages')
let self._cachedMessages = {} let self._cachedMessages = {}
let errors = self.errors() + self.warnings() let errors = self.errors() + self.warnings()
@ -280,14 +280,14 @@ endfunction " }}}2
"would return all errors for buffer 10. "would return all errors for buffer 10.
" "
"Note that all comparisons are done with ==? "Note that all comparisons are done with ==?
function! g:SyntasticLoclist.filter(filters) " {{{2 function! g:SyntasticLoclist.filter(filters) abort " {{{2
let conditions = values(map(copy(a:filters), 's:_translate(v:key, v:val)')) let conditions = values(map(copy(a:filters), 's:_translate(v:key, v:val)'))
let filter = len(conditions) == 1 ? let filter = len(conditions) == 1 ?
\ conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ') \ conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
return filter(copy(self._rawLoclist), filter) return filter(copy(self._rawLoclist), filter)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticLoclist.setloclist() " {{{2 function! g:SyntasticLoclist.setloclist() abort " {{{2
if !exists('w:syntastic_loclist_set') if !exists('w:syntastic_loclist_set')
let w:syntastic_loclist_set = 0 let w:syntastic_loclist_set = 0
endif endif
@ -298,15 +298,15 @@ function! g:SyntasticLoclist.setloclist() " {{{2
endfunction " }}}2 endfunction " }}}2
"display the cached errors for this buf in the location list "display the cached errors for this buf in the location list
function! g:SyntasticLoclist.show() " {{{2 function! g:SyntasticLoclist.show() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show')
call self.setloclist() call self.setloclist()
if !self.isEmpty() if !self.isEmpty()
let num = winnr() let num = winnr()
execute "lopen " . syntastic#util#var('loc_list_height') execute 'lopen ' . syntastic#util#var('loc_list_height')
if num != winnr() if num != winnr()
wincmd p execute num . 'wincmd w'
endif endif
" try to find the loclist window and set w:quickfix_title " try to find the loclist window and set w:quickfix_title
@ -320,7 +320,7 @@ function! g:SyntasticLoclist.show() " {{{2
" errors == getloclist(0) is the only somewhat safe way to " errors == getloclist(0) is the only somewhat safe way to
" achieve that " achieve that
if strpart(title, 0, 16) ==# ':SyntasticCheck ' || if strpart(title, 0, 16) ==# ':SyntasticCheck ' ||
\ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) ) \ ( (title ==# '' || title ==# ':setloclist()') && errors == getloclist(0) )
call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name)
call setbufvar(buf, 'syntastic_owner_buffer', self._owner) call setbufvar(buf, 'syntastic_owner_buffer', self._owner)
endif endif
@ -333,7 +333,7 @@ endfunction " }}}2
" Public functions {{{1 " Public functions {{{1
function! SyntasticLoclistHide() " {{{2 function! SyntasticLoclistHide() abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: hide') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: hide')
silent! lclose silent! lclose
endfunction " }}}2 endfunction " }}}2
@ -342,11 +342,11 @@ endfunction " }}}2
" Utilities {{{1 " Utilities {{{1
function! s:_translate(key, val) " {{{2 function! s:_translate(key, val) abort " {{{2
return 'get(v:val, ' . string(a:key) . ', "") ==? ' . string(a:val) return 'get(v:val, ' . string(a:key) . ', "") ==? ' . string(a:val)
endfunction " }}}2 endfunction " }}}2
function! s:_set_screen_column(item) " {{{2 function! s:_set_screen_column(item) abort " {{{2
if !has_key(a:item, 'scol') if !has_key(a:item, 'scol')
let col = get(a:item, 'col', 0) let col = get(a:item, 'col', 0)
if col != 0 && get(a:item, 'vcol', 0) == 0 if col != 0 && get(a:item, 'vcol', 0) == 0
@ -363,7 +363,7 @@ function! s:_set_screen_column(item) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! s:_remove_shadowed_items(errors) " {{{2 function! s:_remove_shadowed_items(errors) abort " {{{2
" keep only the first message at a given column " keep only the first message at a given column
let i = 0 let i = 0
while i < len(a:errors) - 1 while i < len(a:errors) - 1
@ -395,7 +395,7 @@ function! s:_remove_shadowed_items(errors) " {{{2
endwhile endwhile
endfunction " }}}2 endfunction " }}}2
function! s:_compare_error_items_by_columns(a, b) " {{{2 function! s:_compare_error_items_by_columns(a, b) abort " {{{2
if a:a['bufnr'] != a:b['bufnr'] if a:a['bufnr'] != a:b['bufnr']
" group by file " group by file
return a:a['bufnr'] - a:b['bufnr'] return a:a['bufnr'] - a:b['bufnr']
@ -413,7 +413,7 @@ function! s:_compare_error_items_by_columns(a, b) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! s:_compare_error_items_by_lines(a, b) " {{{2 function! s:_compare_error_items_by_lines(a, b) abort " {{{2
if a:a['bufnr'] != a:b['bufnr'] if a:a['bufnr'] != a:b['bufnr']
" group by file " group by file
return a:a['bufnr'] - a:b['bufnr'] return a:a['bufnr'] - a:b['bufnr']

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_modemap") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_modemap') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_modemap = 1 let g:loaded_syntastic_modemap = 1
@ -7,7 +7,7 @@ let g:SyntasticModeMap = {}
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticModeMap.Instance() " {{{2 function! g:SyntasticModeMap.Instance() abort " {{{2
if !exists('s:SyntasticModeMapInstance') if !exists('s:SyntasticModeMapInstance')
let s:SyntasticModeMapInstance = copy(self) let s:SyntasticModeMapInstance = copy(self)
call s:SyntasticModeMapInstance.synch() call s:SyntasticModeMapInstance.synch()
@ -16,7 +16,7 @@ function! g:SyntasticModeMap.Instance() " {{{2
return s:SyntasticModeMapInstance return s:SyntasticModeMapInstance
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.synch() " {{{2 function! g:SyntasticModeMap.synch() abort " {{{2
if exists('g:syntastic_mode_map') if exists('g:syntastic_mode_map')
let self._mode = get(g:syntastic_mode_map, 'mode', 'active') let self._mode = get(g:syntastic_mode_map, 'mode', 'active')
let self._activeFiletypes = copy(get(g:syntastic_mode_map, 'active_filetypes', [])) let self._activeFiletypes = copy(get(g:syntastic_mode_map, 'active_filetypes', []))
@ -28,7 +28,7 @@ function! g:SyntasticModeMap.synch() " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.allowsAutoChecking(filetype) " {{{2 function! g:SyntasticModeMap.allowsAutoChecking(filetype) abort " {{{2
let fts = split(a:filetype, '\m\.') let fts = split(a:filetype, '\m\.')
if self.isPassive() if self.isPassive()
@ -38,7 +38,7 @@ function! g:SyntasticModeMap.allowsAutoChecking(filetype) " {{{2
endif endif
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.doAutoChecking() " {{{2 function! g:SyntasticModeMap.doAutoChecking() abort " {{{2
let local_mode = get(b:, 'syntastic_mode', '') let local_mode = get(b:, 'syntastic_mode', '')
if local_mode ==# 'active' || local_mode ==# 'passive' if local_mode ==# 'active' || local_mode ==# 'passive'
return local_mode ==# 'active' return local_mode ==# 'active'
@ -47,11 +47,11 @@ function! g:SyntasticModeMap.doAutoChecking() " {{{2
return self.allowsAutoChecking(&filetype) return self.allowsAutoChecking(&filetype)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.isPassive() " {{{2 function! g:SyntasticModeMap.isPassive() abort " {{{2
return self._mode ==# 'passive' return self._mode ==# 'passive'
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.toggleMode() " {{{2 function! g:SyntasticModeMap.toggleMode() abort " {{{2
call self.synch() call self.synch()
if self._mode ==# 'active' if self._mode ==# 'active'
@ -67,12 +67,12 @@ function! g:SyntasticModeMap.toggleMode() " {{{2
let g:syntastic_mode_map['mode'] = self._mode let g:syntastic_mode_map['mode'] = self._mode
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.echoMode() " {{{2 function! g:SyntasticModeMap.echoMode() abort " {{{2
echo "Syntastic: " . self._mode . " mode enabled" echo 'Syntastic: ' . self._mode . ' mode enabled'
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.modeInfo(filetypes) " {{{2 function! g:SyntasticModeMap.modeInfo(filetypes) abort " {{{2
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION . ' (Vim ' . v:version . ', ' . g:_SYNTASTIC_UNAME . ')'
let type = len(a:filetypes) ? a:filetypes[0] : &filetype let type = len(a:filetypes) ? a:filetypes[0] : &filetype
echomsg 'Info for filetype: ' . type echomsg 'Info for filetype: ' . type
@ -104,11 +104,11 @@ endfunction " }}}2
" Private methods {{{1 " Private methods {{{1
function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) " {{{2 function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) abort " {{{2
return !empty(filter(copy(a:filetypes), 'index(self._activeFiletypes, v:val) != -1')) return !empty(filter(copy(a:filetypes), 'index(self._activeFiletypes, v:val) != -1'))
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) " {{{2 function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) abort " {{{2
return empty(filter(copy(a:filetypes), 'index(self._passiveFiletypes, v:val) != -1')) return empty(filter(copy(a:filetypes), 'index(self._passiveFiletypes, v:val) != -1'))
endfunction " }}}2 endfunction " }}}2

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifiers") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_notifiers') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_notifiers = 1 let g:loaded_syntastic_notifiers = 1
@ -13,7 +13,7 @@ lockvar! s:_PERSISTENT_NOTIFIERS
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticNotifiers.Instance() " {{{2 function! g:SyntasticNotifiers.Instance() abort " {{{2
if !exists('s:SyntasticNotifiersInstance') if !exists('s:SyntasticNotifiersInstance')
let s:SyntasticNotifiersInstance = copy(self) let s:SyntasticNotifiersInstance = copy(self)
call s:SyntasticNotifiersInstance._initNotifiers() call s:SyntasticNotifiersInstance._initNotifiers()
@ -22,7 +22,7 @@ function! g:SyntasticNotifiers.Instance() " {{{2
return s:SyntasticNotifiersInstance return s:SyntasticNotifiersInstance
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticNotifiers.refresh(loclist) " {{{2 function! g:SyntasticNotifiers.refresh(loclist) abort " {{{2
if !a:loclist.isEmpty() && !a:loclist.isNewerThan([]) if !a:loclist.isEmpty() && !a:loclist.isNewerThan([])
" loclist not fully constructed yet " loclist not fully constructed yet
return return
@ -48,7 +48,7 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2
endfor endfor
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticNotifiers.reset(loclist) " {{{2 function! g:SyntasticNotifiers.reset(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: reset') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: reset')
for type in self._enabled_types for type in self._enabled_types
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
@ -71,7 +71,7 @@ endfunction " }}}2
" Private methods {{{1 " Private methods {{{1
function! g:SyntasticNotifiers._initNotifiers() " {{{2 function! g:SyntasticNotifiers._initNotifiers() abort " {{{2
let self._notifier = {} let self._notifier = {}
for type in s:_NOTIFIER_TYPES for type in s:_NOTIFIER_TYPES
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_registry") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_registry') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_registry = 1 let g:loaded_syntastic_registry = 1
@ -8,6 +8,7 @@ let g:loaded_syntastic_registry = 1
let s:_DEFAULT_CHECKERS = { let s:_DEFAULT_CHECKERS = {
\ 'actionscript': ['mxmlc'], \ 'actionscript': ['mxmlc'],
\ 'ada': ['gcc'], \ 'ada': ['gcc'],
\ 'apiblueprint': ['snowcrash'],
\ 'applescript': ['osacompile'], \ 'applescript': ['osacompile'],
\ 'asciidoc': ['asciidoc'], \ 'asciidoc': ['asciidoc'],
\ 'asm': ['gcc'], \ 'asm': ['gcc'],
@ -52,7 +53,9 @@ let s:_DEFAULT_CHECKERS = {
\ 'lua': ['luac'], \ 'lua': ['luac'],
\ 'markdown': ['mdl'], \ 'markdown': ['mdl'],
\ 'matlab': ['mlint'], \ 'matlab': ['mlint'],
\ 'mercury': ['mmc'],
\ 'nasm': ['nasm'], \ 'nasm': ['nasm'],
\ 'nix': ['nix'],
\ 'nroff': ['mandoc'], \ 'nroff': ['mandoc'],
\ 'objc': ['gcc'], \ 'objc': ['gcc'],
\ 'objcpp': ['gcc'], \ 'objcpp': ['gcc'],
@ -73,6 +76,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'scss': ['sass', 'scss_lint'], \ 'scss': ['sass', 'scss_lint'],
\ 'sh': ['sh', 'shellcheck'], \ 'sh': ['sh', 'shellcheck'],
\ 'slim': ['slimrb'], \ 'slim': ['slimrb'],
\ 'sml': ['smlnj'],
\ 'spec': ['rpmlint'], \ 'spec': ['rpmlint'],
\ 'tcl': ['nagelfar'], \ 'tcl': ['nagelfar'],
\ 'tex': ['lacheck', 'chktex'], \ 'tex': ['lacheck', 'chktex'],
@ -91,7 +95,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'yaml': ['jsyaml'], \ 'yaml': ['jsyaml'],
\ 'z80': ['z80syntaxchecker'], \ 'z80': ['z80syntaxchecker'],
\ 'zpt': ['zptlint'], \ 'zpt': ['zptlint'],
\ 'zsh': ['zsh', 'shellcheck'], \ 'zsh': ['zsh'],
\ } \ }
lockvar! s:_DEFAULT_CHECKERS lockvar! s:_DEFAULT_CHECKERS
@ -102,6 +106,7 @@ let s:_DEFAULT_FILETYPE_MAP = {
\ 'litcoffee': 'coffee', \ 'litcoffee': 'coffee',
\ 'mail': 'text', \ 'mail': 'text',
\ 'mkd': 'markdown', \ 'mkd': 'markdown',
\ 'pe-puppet': 'puppet',
\ 'sgml': 'docbk', \ 'sgml': 'docbk',
\ 'sgmllnx': 'docbk', \ 'sgmllnx': 'docbk',
\ } \ }
@ -136,7 +141,7 @@ let g:SyntasticRegistry = {}
" parameters, all private methods take normalized filetypes. Public methods " parameters, all private methods take normalized filetypes. Public methods
" are thus supposed to normalize filetypes before calling private methods. " are thus supposed to normalize filetypes before calling private methods.
function! g:SyntasticRegistry.Instance() " {{{2 function! g:SyntasticRegistry.Instance() abort " {{{2
if !exists('s:SyntasticRegistryInstance') if !exists('s:SyntasticRegistryInstance')
let s:SyntasticRegistryInstance = copy(self) let s:SyntasticRegistryInstance = copy(self)
let s:SyntasticRegistryInstance._checkerMap = {} let s:SyntasticRegistryInstance._checkerMap = {}
@ -145,7 +150,7 @@ function! g:SyntasticRegistry.Instance() " {{{2
return s:SyntasticRegistryInstance return s:SyntasticRegistryInstance
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) " {{{2 function! g:SyntasticRegistry.CreateAndRegisterChecker(args) abort " {{{2
let checker = g:SyntasticChecker.New(a:args) let checker = g:SyntasticChecker.New(a:args)
let registry = g:SyntasticRegistry.Instance() let registry = g:SyntasticRegistry.Instance()
call registry._registerChecker(checker) call registry._registerChecker(checker)
@ -155,7 +160,7 @@ endfunction " }}}2
" If hints_list is empty, user settings are are used instead. Checkers are " If hints_list is empty, user settings are are used instead. Checkers are
" not checked for availability (that is, the corresponding IsAvailable() are " not checked for availability (that is, the corresponding IsAvailable() are
" not run). " not run).
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2 function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) abort " {{{2
let ft = s:_normalise_filetype(a:ftalias) let ft = s:_normalise_filetype(a:ftalias)
call self._loadCheckersFor(ft) call self._loadCheckersFor(ft)
@ -178,11 +183,11 @@ endfunction " }}}2
" Same as getCheckers(), but keep only the checkers available. This runs the " Same as getCheckers(), but keep only the checkers available. This runs the
" corresponding IsAvailable() functions for all checkers. " corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2 function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()') return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2 function! g:SyntasticRegistry.getKnownFiletypes() abort " {{{2
let types = keys(s:_DEFAULT_CHECKERS) let types = keys(s:_DEFAULT_CHECKERS)
call extend(types, keys(s:_DEFAULT_FILETYPE_MAP)) call extend(types, keys(s:_DEFAULT_FILETYPE_MAP))
@ -198,13 +203,13 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
return syntastic#util#unique(types) return syntastic#util#unique(types)
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2 function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) abort " {{{2
let ft = s:_normalise_filetype(a:ftalias) let ft = s:_normalise_filetype(a:ftalias)
call self._loadCheckersFor(ft) call self._loadCheckersFor(ft)
return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' )) return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' ))
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:_normalise_filetype(v:val)' )) let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:_normalise_filetype(v:val)' ))
if len(ft_list) != 1 if len(ft_list) != 1
let available = [] let available = []
@ -273,16 +278,16 @@ function! g:SyntasticRegistry._registerChecker(checker) abort " {{{2
let self._checkerMap[ft][name] = a:checker let self._checkerMap[ft][name] = a:checker
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) " {{{2 function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) abort " {{{2
return filter( map(copy(a:list), 'get(a:checkers_map, v:val, {})'), '!empty(v:val)' ) return filter( map(copy(a:list), 'get(a:checkers_map, v:val, {})'), '!empty(v:val)' )
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2 function! g:SyntasticRegistry._loadCheckersFor(filetype) abort " {{{2
if has_key(self._checkerMap, a:filetype) if has_key(self._checkerMap, a:filetype)
return return
endif endif
execute "runtime! syntax_checkers/" . a:filetype . "/*.vim" execute 'runtime! syntax_checkers/' . a:filetype . '/*.vim'
if !has_key(self._checkerMap, a:filetype) if !has_key(self._checkerMap, a:filetype)
let self._checkerMap[a:filetype] = {} let self._checkerMap[a:filetype] = {}
@ -290,7 +295,7 @@ function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2
endfunction " }}}2 endfunction " }}}2
" Check for obsolete variable g:syntastic_<filetype>_checker " Check for obsolete variable g:syntastic_<filetype>_checker
function! g:SyntasticRegistry._checkDeprecation(filetype) " {{{2 function! g:SyntasticRegistry._checkDeprecation(filetype) abort " {{{2
if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers') if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers')
let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker] let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker]
call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated') call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated')
@ -303,14 +308,14 @@ endfunction " }}}2
"resolve filetype aliases, and replace - with _ otherwise we cant name "resolve filetype aliases, and replace - with _ otherwise we cant name
"syntax checker functions legally for filetypes like "gentoo-metadata" "syntax checker functions legally for filetypes like "gentoo-metadata"
function! s:_normalise_filetype(ftalias) " {{{2 function! s:_normalise_filetype(ftalias) abort " {{{2
let ft = get(s:_DEFAULT_FILETYPE_MAP, a:ftalias, a:ftalias) let ft = get(s:_DEFAULT_FILETYPE_MAP, a:ftalias, a:ftalias)
let ft = get(g:syntastic_filetype_map, ft, ft) let ft = get(g:syntastic_filetype_map, ft, ft)
let ft = substitute(ft, '\m-', '_', 'g') let ft = substitute(ft, '\m-', '_', 'g')
return ft return ft
endfunction " }}}2 endfunction " }}}2
function! s:_disabled_by_eclim(filetype) " {{{2 function! s:_disabled_by_eclim(filetype) abort " {{{2
if index(s:_ECLIM_TYPES, a:filetype) >= 0 if index(s:_ECLIM_TYPES, a:filetype) >= 0
let lang = toupper(a:filetype[0]) . a:filetype[1:] let lang = toupper(a:filetype[0]) . a:filetype[1:]
let ft = a:filetype !=# 'cpp' ? lang : 'C' let ft = a:filetype !=# 'cpp' ? lang : 'C'
@ -320,7 +325,7 @@ function! s:_disabled_by_eclim(filetype) " {{{2
return 0 return 0
endfunction " }}}2 endfunction " }}}2
function! s:_disabled_by_ycm(filetype) " {{{2 function! s:_disabled_by_ycm(filetype) abort " {{{2
return index(s:_YCM_TYPES, a:filetype) >= 0 return index(s:_YCM_TYPES, a:filetype) >= 0
endfunction " }}}2 endfunction " }}}2

@ -1,4 +1,4 @@
if exists("g:loaded_syntastic_notifier_signs") || !exists("g:loaded_syntastic_plugin") if exists('g:loaded_syntastic_notifier_signs') || !exists('g:loaded_syntastic_plugin')
finish finish
endif endif
let g:loaded_syntastic_notifier_signs = 1 let g:loaded_syntastic_notifier_signs = 1
@ -19,7 +19,7 @@ let s:setup_done = 0
" Public methods {{{1 " Public methods {{{1
function! g:SyntasticSignsNotifier.New() " {{{2 function! g:SyntasticSignsNotifier.New() abort " {{{2
let newObj = copy(self) let newObj = copy(self)
if !s:setup_done if !s:setup_done
@ -31,11 +31,11 @@ function! g:SyntasticSignsNotifier.New() " {{{2
return newObj return newObj
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticSignsNotifier.enabled() " {{{2 function! g:SyntasticSignsNotifier.enabled() abort " {{{2
return has('signs') && syntastic#util#var('enable_signs') return has('signs') && syntastic#util#var('enable_signs')
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2 function! g:SyntasticSignsNotifier.refresh(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh') call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh')
let old_signs = copy(self._bufSignIds()) let old_signs = copy(self._bufSignIds())
if self.enabled() if self.enabled()
@ -49,7 +49,7 @@ endfunction " }}}2
" Private methods {{{1 " Private methods {{{1
" One time setup: define our own sign types and highlighting " One time setup: define our own sign types and highlighting
function! g:SyntasticSignsNotifier._setup() " {{{2 function! g:SyntasticSignsNotifier._setup() abort " {{{2
if has('signs') if has('signs')
if !hlexists('SyntasticErrorSign') if !hlexists('SyntasticErrorSign')
highlight link SyntasticErrorSign error highlight link SyntasticErrorSign error
@ -83,7 +83,7 @@ function! g:SyntasticSignsNotifier._setup() " {{{2
endfunction " }}}2 endfunction " }}}2
" Place signs by all syntax errors in the buffer " Place signs by all syntax errors in the buffer
function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2 function! g:SyntasticSignsNotifier._signErrors(loclist) abort " {{{2
let loclist = a:loclist let loclist = a:loclist
if !loclist.isEmpty() if !loclist.isEmpty()
@ -107,7 +107,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
let sign_subtype = get(i, 'subtype', '') let sign_subtype = get(i, 'subtype', '')
let sign_type = 'Syntastic' . sign_subtype . sign_severity let sign_type = 'Syntastic' . sign_subtype . sign_severity
execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] execute 'sign place ' . s:next_sign_id . ' line=' . i['lnum'] . ' name=' . sign_type . ' buffer=' . i['bufnr']
call add(self._bufSignIds(), s:next_sign_id) call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1 let s:next_sign_id += 1
endif endif
@ -116,18 +116,18 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
endfunction " }}}2 endfunction " }}}2
" Remove the signs with the given ids from this buffer " Remove the signs with the given ids from this buffer
function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2 function! g:SyntasticSignsNotifier._removeSigns(ids) abort " {{{2
if has('signs') if has('signs')
for s in reverse(copy(a:ids)) for s in reverse(copy(a:ids))
execute "sign unplace " . s execute 'sign unplace ' . s
call remove(self._bufSignIds(), index(self._bufSignIds(), s)) call remove(self._bufSignIds(), index(self._bufSignIds(), s))
endfor endfor
endif endif
endfunction " }}}2 endfunction " }}}2
" Get all the ids of the SyntaxError signs in the buffer " Get all the ids of the SyntaxError signs in the buffer
function! g:SyntasticSignsNotifier._bufSignIds() " {{{2 function! g:SyntasticSignsNotifier._bufSignIds() abort " {{{2
if !exists("b:syntastic_private_sign_ids") if !exists('b:syntastic_private_sign_ids')
let b:syntastic_private_sign_ids = [] let b:syntastic_private_sign_ids = []
endif endif
return b:syntastic_private_sign_ids return b:syntastic_private_sign_ids

@ -37,7 +37,7 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
endif endif
return term != '' ? '\V\<' . escape(term, '\') . '\>' : '' return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction endfunction
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict

@ -0,0 +1,66 @@
"============================================================================
"File: snowcrash.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_apiblueprint_snowcrash_checker')
finish
endif
let g:loaded_syntastic_apiblueprint_snowcrash_checker = 1
if !exists('g:syntastic_apiblueprint_snowcrash_sort')
let g:syntastic_apiblueprint_snowcrash_sort = 1
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_apiblueprint_snowcrash_GetLocList() dict
let makeprg = self.makeprgBuild({ 'post_args': '-u -l' })
let errorformat =
\ '%trror: (%n) %m,' .
\ '%tarning: (%n) %m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 2] })
for e in loclist
let matches = matchlist(e['text'], '\v^(.+); line (\d+), column (\d+) - line (\d+), column (\d+)$')
if len(matches) > 5
let e['lnum'] = str2nr(matches[2])
let e['col'] = str2nr(matches[3])
let e['vcol'] = 0
if matches[2] == matches[4]
let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . matches[5] . 'c'
endif
let e['text'] = matches[1]
else
let e['valid'] = 0
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'apiblueprint',
\ 'name': 'snowcrash'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -25,7 +25,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_applescript_osacompile_checker") if exists('g:loaded_syntastic_applescript_osacompile_checker')
finish finish
endif endif
let g:loaded_syntastic_applescript_osacompile_checker = 1 let g:loaded_syntastic_applescript_osacompile_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_asciidoc_asciidoc_checker") if exists('g:loaded_syntastic_asciidoc_asciidoc_checker')
finish finish
endif endif
let g:loaded_syntastic_asciidoc_asciidoc_checker = 1 let g:loaded_syntastic_asciidoc_asciidoc_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_bemhtml_bemhtmllint_checker") if exists('g:loaded_syntastic_bemhtml_bemhtmllint_checker')
finish finish
endif endif

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_bro_bro_checker") if exists('g:loaded_syntastic_bro_bro_checker')
finish finish
endif endif
let g:loaded_syntastic_bro_bro_checker = 1 let g:loaded_syntastic_bro_bro_checker = 1
@ -20,7 +20,7 @@ set cpo&vim
function! SyntaxCheckers_bro_bro_GetHighlightRegex(item) function! SyntaxCheckers_bro_bro_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m at or near "\zs[^"]\+\ze"') let term = matchstr(a:item['text'], '\m at or near "\zs[^"]\+\ze"')
return term != '' ? '\V\<' . escape(term, '\') . '\>' : '' return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction endfunction
function! SyntaxCheckers_bro_bro_IsAvailable() dict function! SyntaxCheckers_bro_bro_IsAvailable() dict
@ -28,7 +28,7 @@ function! SyntaxCheckers_bro_bro_IsAvailable() dict
return 0 return 0
endif endif
if system(self.getExecEscaped() . ' --help') !~# '--parse-only' if syntastic#util#system(self.getExecEscaped() . ' --help') !~# '--parse-only'
call self.log('unknown option "--parse-only"') call self.log('unknown option "--parse-only"')
return 0 return 0
endif endif

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_c_checkpatch_checker") if exists('g:loaded_syntastic_c_checkpatch_checker')
finish finish
endif endif
let g:loaded_syntastic_c_checkpatch_checker = 1 let g:loaded_syntastic_c_checkpatch_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_c_clang_check_checker") if exists('g:loaded_syntastic_c_clang_check_checker')
finish finish
endif endif
let g:loaded_syntastic_c_clang_check_checker = 1 let g:loaded_syntastic_c_clang_check_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_c_clang_tidy_checker") if exists('g:loaded_syntastic_c_clang_tidy_checker')
finish finish
endif endif
let g:loaded_syntastic_c_clang_tidy_checker = 1 let g:loaded_syntastic_c_clang_tidy_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_c_cppcheck_checker") if exists('g:loaded_syntastic_c_cppcheck_checker')
finish finish
endif endif
let g:loaded_syntastic_c_cppcheck_checker = 1 let g:loaded_syntastic_c_cppcheck_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_c_oclint_checker") if exists('g:loaded_syntastic_c_oclint_checker')
finish finish
endif endif
let g:loaded_syntastic_c_oclint_checker = 1 let g:loaded_syntastic_c_oclint_checker = 1

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

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_c_sparse_checker") if exists('g:loaded_syntastic_c_sparse_checker')
finish finish
endif endif
let g:loaded_syntastic_c_sparse_checker = 1 let g:loaded_syntastic_c_sparse_checker = 1
@ -33,7 +33,7 @@ function! SyntaxCheckers_c_sparse_GetLocList() dict
let loclist = SyntasticMake({ let loclist = SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")}, \ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1] }) \ 'returns': [0, 1] })
return loclist return loclist
endfunction endfunction

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_c_splint_checker") if exists('g:loaded_syntastic_c_splint_checker')
finish finish
endif endif
let g:loaded_syntastic_c_splint_checker = 1 let g:loaded_syntastic_c_splint_checker = 1

@ -20,11 +20,11 @@ set cpo&vim
function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item) function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item)
let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+") let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+")
if field != '' if field !=# ''
return '\v\c^\s*' . field . '\s*:\s*\zs.*$' return '\v\c^\s*' . field . '\s*:\s*\zs.*$'
endif endif
let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'") let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'")
if field != '' if field !=# ''
return '\V\c\<' . escape(field, '\') . '\>' return '\V\c\<' . escape(field, '\') . '\>'
endif endif
return '' return ''

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_chef_foodcritic_checker") if exists('g:loaded_syntastic_chef_foodcritic_checker')
finish finish
endif endif
let g:loaded_syntastic_chef_foodcritic_checker = 1 let g:loaded_syntastic_chef_foodcritic_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_co_coco_checker") if exists('g:loaded_syntastic_co_coco_checker')
finish finish
endif endif
let g:loaded_syntastic_co_coco_checker = 1 let g:loaded_syntastic_co_coco_checker = 1

@ -13,7 +13,7 @@
" Note: this script requires CoffeeScript version 1.6.2 or newer. " Note: this script requires CoffeeScript version 1.6.2 or newer.
" "
if exists("g:loaded_syntastic_coffee_coffee_checker") if exists('g:loaded_syntastic_coffee_coffee_checker')
finish finish
endif endif
let g:loaded_syntastic_coffee_coffee_checker = 1 let g:loaded_syntastic_coffee_coffee_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_coffee_coffeelint_checker") if exists('g:loaded_syntastic_coffee_coffeelint_checker')
finish finish
endif endif
let g:loaded_syntastic_coffee_coffeelint_checker = 1 let g:loaded_syntastic_coffee_coffeelint_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_coq_coqtop_checker") if exists('g:loaded_syntastic_coq_coqtop_checker')
finish finish
endif endif
let g:loaded_syntastic_coq_coqtop_checker = 1 let g:loaded_syntastic_coq_coqtop_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cpp_clang_check_checker") if exists('g:loaded_syntastic_cpp_clang_check_checker')
finish finish
endif endif
let g:loaded_syntastic_cpp_clang_check_checker = 1 let g:loaded_syntastic_cpp_clang_check_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cpp_clang_tidy_checker") if exists('g:loaded_syntastic_cpp_clang_tidy_checker')
finish finish
endif endif
let g:loaded_syntastic_cpp_clang_tidy_checker = 1 let g:loaded_syntastic_cpp_clang_tidy_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cpp_cppcheck_checker") if exists('g:loaded_syntastic_cpp_cppcheck_checker')
finish finish
endif endif
let g:loaded_syntastic_cpp_cppcheck_checker = 1 let g:loaded_syntastic_cpp_cppcheck_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cpp_cpplint_checker") if exists('g:loaded_syntastic_cpp_cpplint_checker')
finish finish
endif endif
let g:loaded_syntastic_cpp_cpplint_checker = 1 let g:loaded_syntastic_cpp_cpplint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cpp_oclint_checker") if exists('g:loaded_syntastic_cpp_oclint_checker')
finish finish
endif endif
let g:loaded_syntastic_cpp_oclint_checker = 1 let g:loaded_syntastic_cpp_oclint_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cpp_pc_lint_checker") if exists('g:loaded_syntastic_cpp_pc_lint_checker')
finish finish
endif endif
let g:loaded_syntastic_cpp_pc_lint_checker = 1 let g:loaded_syntastic_cpp_pc_lint_checker = 1

@ -0,0 +1,48 @@
"============================================================================
"File: verapp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Lucas Verney <phyks@phyks.me>
"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.
"
" Tested with Vera++ 1.3.0
"============================================================================
if exists('g:loaded_syntastic_cpp_verapp_checker')
finish
endif
let g:loaded_syntastic_cpp_verapp_checker = 1
if !exists('g:syntastic_verapp_config_file')
let g:syntastic_verapp_config_file = '.syntastic_verapp_config'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp_verapp_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': syntastic#c#ReadConfig(g:syntastic_verapp_config_file),
\ 'args_after': '--show-rule --no-duplicate -S -c -' })
let errorformat = '%f:%t:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'checkstyle',
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'verapp',
\ 'exec': 'vera++'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cs_mcs_checker") if exists('g:loaded_syntastic_cs_mcs_checker')
finish finish
endif endif
let g:loaded_syntastic_cs_mcs_checker = 1 let g:loaded_syntastic_cs_mcs_checker = 1
@ -26,7 +26,7 @@ function! SyntaxCheckers_cs_mcs_GetLocList() dict
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} }) \ 'defaults': {'bufnr': bufnr('')} })
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -33,7 +33,7 @@ function! SyntaxCheckers_css_csslint_GetLocList() dict
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} }) \ 'defaults': {'bufnr': bufnr('')} })
endfunction endfunction

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_css_phpcs_checker") if exists('g:loaded_syntastic_css_phpcs_checker')
finish finish
endif endif
let g:loaded_syntastic_css_phpcs_checker = 1 let g:loaded_syntastic_css_phpcs_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_css_prettycss_checker") if exists('g:loaded_syntastic_css_prettycss_checker')
finish finish
endif endif
let g:loaded_syntastic_css_prettycss_checker = 1 let g:loaded_syntastic_css_prettycss_checker = 1
@ -23,8 +23,8 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$') let term = matchstr(a:item['text'], '\m (\zs[^)]\+\ze)$')
if term != '' if term !=# ''
let term = '\V' . escape(term, '\') let term = '\V' . escape(term, '\')
endif endif
return term return term
@ -42,10 +42,10 @@ function! SyntaxCheckers_css_prettycss_GetLocList() dict
let loclist = SyntasticMake({ let loclist = SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} }) \ 'defaults': {'bufnr': bufnr('')} })
for e in loclist for e in loclist
let e["text"] .= ')' let e['text'] .= ')'
endfor endfor
return loclist return loclist

@ -11,7 +11,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_css_recess_checker") if exists('g:loaded_syntastic_css_recess_checker')
finish finish
endif endif
let g:loaded_syntastic_css_recess_checker = 1 let g:loaded_syntastic_css_recess_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cucumber_cucumber_checker") if exists('g:loaded_syntastic_cucumber_cucumber_checker')
finish finish
endif endif
let g:loaded_syntastic_cucumber_cucumber_checker = 1 let g:loaded_syntastic_cucumber_cucumber_checker = 1

@ -6,7 +6,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_cuda_nvcc_checker") if exists('g:loaded_syntastic_cuda_nvcc_checker')
finish finish
endif endif
let g:loaded_syntastic_cuda_nvcc_checker = 1 let g:loaded_syntastic_cuda_nvcc_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_dart_dartanalyzer_checker") if exists('g:loaded_syntastic_dart_dartanalyzer_checker')
finish finish
endif endif
let g:loaded_syntastic_dart_dartanalyzer_checker = 1 let g:loaded_syntastic_dart_dartanalyzer_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_docbk_xmllint_checker") if exists('g:loaded_syntastic_docbk_xmllint_checker')
finish finish
endif endif
let g:loaded_syntastic_docbk_xmllint_checker = 1 let g:loaded_syntastic_docbk_xmllint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_dustjs_swiffer_checker") if exists('g:loaded_syntastic_dustjs_swiffer_checker')
finish finish
endif endif

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_elixir_elixir_checker") if exists('g:loaded_syntastic_elixir_elixir_checker')
finish finish
endif endif
let g:loaded_syntastic_elixir_elixir_checker = 1 let g:loaded_syntastic_elixir_elixir_checker = 1
@ -35,7 +35,7 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() dict
let make_options = {} let make_options = {}
let compile_command = 'elixir' let compile_command = 'elixir'
let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h', 1)) let mix_file = findfile('mix.exs', escape(expand('%:p:h', 1), ' ') . ';')
if filereadable(mix_file) if filereadable(mix_file)
let compile_command = 'mix compile' let compile_command = 'mix compile'
@ -44,7 +44,9 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() dict
let make_options['makeprg'] = self.makeprgBuild({ 'exe': compile_command }) let make_options['makeprg'] = self.makeprgBuild({ 'exe': compile_command })
let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m' let make_options['errorformat'] =
\ '%E** %*[^\ ] %f:%l: %m,' .
\ '%W%f:%l: warning: %m'
return SyntasticMake(make_options) return SyntasticMake(make_options)
endfunction endfunction

@ -1,56 +1,66 @@
#!/usr/bin/env escript #!/usr/bin/env escript
-export([main/1]).
main([FileName]) -> main([File]) ->
LibDirs = (["ebin", "include", "src", "test"] ++ Dir = get_root(filename:dirname(File)),
filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")), Defs = [strong_validation,
compile(FileName, LibDirs); warn_export_all,
warn_export_vars,
warn_shadow_vars,
warn_obsolete_guard,
warn_unused_import,
report,
{i, Dir ++ "/include"}],
RebarFile = rebar_file(Dir),
RebarOpts = rebar_opts(Dir ++ "/" ++ RebarFile),
code:add_patha(filename:absname("ebin")),
compile:file(File, Defs ++ RebarOpts);
main([FileName, "-rebar", Path, LibDirs]) -> main(_) ->
{ok, L} = file:consult(Path), io:format("Usage: ~s <file>~n", [escript:script_name()]),
P = dict:from_list(L), halt(1).
Root = filename:dirname(Path),
Lib1 = case dict:find(lib_dirs, P) of rebar_file(Dir) ->
{ok, X} -> lists:map(fun(Sub) -> Root ++ "/" ++ Sub end, X); DirList = filename:split(Dir),
_ -> [] case lists:last(DirList) of
end, "test" ->
"rebar.test.config";
_ ->
"rebar.config"
end.
Lib2 = case dict:find(sub_dirs, P) of rebar_opts(RebarFile) ->
{ok, Y} -> lists:foldl( Dir = get_root(filename:dirname(RebarFile)),
fun(Sub,Sofar) -> case file:consult(RebarFile) of
Sofar ++ [ {ok, Terms} ->
Root ++ "/" ++ Sub, RebarLibDirs = proplists:get_value(lib_dirs, Terms, []),
Root ++ "/" ++ Sub ++ "/include", lists:foreach(
Root ++ "/" ++ Sub ++ "/deps", fun(LibDir) ->
Root ++ "/" ++ Sub ++ "/lib" code:add_pathsa(filelib:wildcard(LibDir ++ "/*/ebin"))
] end, [], Y); end, RebarLibDirs),
_ -> [] RebarDepsDir = proplists:get_value(deps_dir, Terms, "deps"),
end, code:add_pathsa(filelib:wildcard(RebarDepsDir ++ "/*/ebin")),
IncludeDeps = {i, filename:join(Dir, RebarDepsDir)},
proplists:get_value(erl_opts, Terms, []) ++ [IncludeDeps];
{error, _} when RebarFile == "rebar.config" ->
fallback_opts();
{error, _} ->
rebar_opts("rebar.config")
end.
LibDirs1 = LibDirs ++ Lib1 ++ Lib2, fallback_opts() ->
%io:format("~p~n", [LibDirs1]), code:add_pathsa(filelib:wildcard("deps/*/ebin")),
compile(FileName, LibDirs1); code:add_pathsa(nested_app_ebins()),
[
{ i, filename:absname("apps") }, { i, filename:absname("deps") } | [ { i, filename:absname(Path) } || Path <- filelib:wildcard("deps/*/apps")]
].
main([FileName | LibDirs]) -> nested_app_ebins() ->
compile(FileName, LibDirs). DetectedAppSrcFiles = filelib:wildcard("deps/*/apps/**/*.app.src"),
[apps_dir_from_src(AppSrcFile)||AppSrcFile<-DetectedAppSrcFiles].
compile(FileName, LibDirs) -> apps_dir_from_src(SrcFile) ->
Root = get_root(filename:dirname(FileName)), SrcDir = filename:dirname(SrcFile),
ok = code:add_pathsa(LibDirs), filename:join(SrcDir, "../../ebin").
compile:file(FileName,
[warn_obsolete_guard,
warn_unused_import,
warn_shadow_vars,
warn_export_vars,
strong_validation,
report] ++
[{i, filename:join(Root, I)} || I <- LibDirs] ++
case lists:member("deps/pmod_transform/include", LibDirs) of
true -> [{parse_transform, pmod_pt}];
_ -> []
end
).
get_root(Dir) -> get_root(Dir) ->
Path = filename:split(filename:absname(Dir)), Path = filename:split(filename:absname(Dir)),

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_erlang_syntaxerl_checker") if exists('g:loaded_syntastic_erlang_syntaxerl_checker')
finish finish
endif endif

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_eruby_ruby_checker") if exists('g:loaded_syntastic_eruby_ruby_checker')
finish finish
endif endif
let g:loaded_syntastic_eruby_ruby_checker = 1 let g:loaded_syntastic_eruby_ruby_checker = 1
@ -35,7 +35,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
" TODO: encodings became useful in ruby 1.9 :) " TODO: encodings became useful in ruby 1.9 :)
if s:ruby_new if s:ruby_new
let enc = &fileencoding != '' ? &fileencoding : &encoding let enc = &fileencoding !=# '' ? &fileencoding : &encoding
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
else else
let encoding_spec = '' let encoding_spec = ''
@ -69,7 +69,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'env': env, \ 'env': env,
\ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) \ 'defaults': { 'bufnr': bufnr(''), 'vcol': 1 } })
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_fortran_gfortran_checker") if exists('g:loaded_syntastic_fortran_gfortran_checker')
finish finish
endif endif
let g:loaded_syntastic_fortran_gfortran_checker = 1 let g:loaded_syntastic_fortran_gfortran_checker = 1
@ -19,28 +19,75 @@ if !exists('g:syntastic_fortran_compiler_options')
let g:syntastic_fortran_compiler_options = '' let g:syntastic_fortran_compiler_options = ''
endif endif
let s:type_map = {}
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict " {{{1
if !exists('g:syntastic_fortran_compiler') if !exists('g:syntastic_fortran_compiler')
let g:syntastic_fortran_compiler = self.getExec() let g:syntastic_fortran_compiler = self.getExec()
endif endif
call self.log('g:syntastic_fortran_compiler = ', g:syntastic_fortran_compiler) call self.log('g:syntastic_fortran_compiler = ', g:syntastic_fortran_compiler)
return executable(expand(g:syntastic_fortran_compiler, 1)) return executable(expand(g:syntastic_fortran_compiler, 1))
endfunction endfunction " }}}1
function! SyntaxCheckers_fortran_gfortran_GetLocList() dict " @vimlint(EVL104, 1, l:errorformat)
return syntastic#c#GetLocList('fortran', 'gfortran', { function! SyntaxCheckers_fortran_gfortran_GetLocList() dict " {{{1
\ 'errorformat': call s:SetCompilerType(g:syntastic_fortran_compiler)
if !has_key(s:type_map, g:syntastic_fortran_compiler)
call syntastic#log#error("checker fortran/gfortran: can't parse version string (abnormal termination?)")
return []
endif
if s:type_map[g:syntastic_fortran_compiler] ==# 'gfortran'
let errorformat =
\ '%-C %#,'. \ '%-C %#,'.
\ '%-C %#%.%#,'. \ '%-C %#%.%#,'.
\ '%A%f:%l.%c:,'. \ '%A%f:%l.%c:,'.
\ '%Z%trror: %m,'. \ '%Z%trror: %m,'.
\ '%Z%tarning: %m,'. \ '%Z%tarning: %m,'.
\ '%-G%.%#', \ '%-G%.%#'
if !exists('g:syntastic_fortran_gfortran_sort')
let g:syntastic_fortran_gfortran_sort = 0
endif
elseif s:type_map[g:syntastic_fortran_compiler] ==# 'ifort'
let errorformat =
\ '%E%f(%l): error #%n: %m,'.
\ '%W%f(%l): warning #%n: %m,'.
\ '%W%f(%l): remark #%n: %m,'.
\ '%-Z%p^,'.
\ '%-G%.%#'
if !exists('g:syntastic_fortran_gfortran_sort')
let g:syntastic_fortran_gfortran_sort = 1
endif
endif
return syntastic#c#GetLocList('fortran', 'gfortran', {
\ 'errorformat': errorformat,
\ 'main_flags': '-fsyntax-only' }) \ 'main_flags': '-fsyntax-only' })
endfunction endfunction " }}}1
" @vimlint(EVL104, 0, l:errorformat)
" Utilities {{{1
function! s:SetCompilerType(exe) " {{{2
if !has_key(s:type_map, a:exe)
try
let ver = filter( split(syntastic#util#system(syntastic#util#shescape(a:exe) . ' --version'), '\n'),
\ 'v:val =~# "\\v^%(GNU Fortran|ifort) "' )[0]
if ver =~# '\m^GNU Fortran '
let s:type_map[a:exe] = 'gfortran'
elseif ver =~# '\m^ifort '
let s:type_map[a:exe] = 'ifort'
endif
catch /\m^Vim\%((\a\+)\)\=:E684/
" do nothing
endtry
endif
endfunction " }}}2
" }}}
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'fortran', \ 'filetype': 'fortran',

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_glsl_cgc_checker") if exists('g:loaded_syntastic_glsl_cgc_checker')
finish finish
endif endif
let g:loaded_syntastic_glsl_cgc_checker = 1 let g:loaded_syntastic_glsl_cgc_checker = 1
@ -33,8 +33,8 @@ function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1
\ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') }) \ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') })
let errorformat = let errorformat =
\ "%E%f(%l) : error %m," . \ '%E%f(%l) : error %m,' .
\ "%W%f(%l) : warning %m" \ '%W%f(%l) : warning %m'
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,

@ -14,7 +14,7 @@
" Use a BufWritePre autocommand to that end: " Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt " autocmd FileType go autocmd BufWritePre <buffer> Fmt
if exists("g:loaded_syntastic_go_go_checker") if exists('g:loaded_syntastic_go_go_checker')
finish finish
endif endif
let g:loaded_syntastic_go_go_checker = 1 let g:loaded_syntastic_go_go_checker = 1
@ -58,8 +58,8 @@ function! SyntaxCheckers_go_go_GetLocList() dict
let opts = syntastic#util#var('go_go_test_args') let opts = syntastic#util#var('go_go_test_args')
let cleanup = 1 let cleanup = 1
endif endif
let opt_str = (type(opts) != type('') || opts != '') ? join(syntastic#util#argsescape(opts)) : opts let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str . ' ' . syntastic#c#NullOutput() let makeprg = self.getExec() . ' ' . cmd . ' ' . opt_str
" The first pattern is for warnings from C compilers. " The first pattern is for warnings from C compilers.
let errorformat = let errorformat =

@ -14,7 +14,7 @@
" Use a BufWritePre autocommand to that end: " Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt " autocmd FileType go autocmd BufWritePre <buffer> Fmt
if exists("g:loaded_syntastic_go_gofmt_checker") if exists('g:loaded_syntastic_go_gofmt_checker')
finish finish
endif endif
let g:loaded_syntastic_go_gofmt_checker = 1 let g:loaded_syntastic_go_gofmt_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_go_golint_checker") if exists('g:loaded_syntastic_go_golint_checker')
finish finish
endif endif
let g:loaded_syntastic_go_golint_checker = 1 let g:loaded_syntastic_go_golint_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_go_gotype_checker") if exists('g:loaded_syntastic_go_gotype_checker')
finish finish
endif endif
let g:loaded_syntastic_go_gotype_checker = 1 let g:loaded_syntastic_go_gotype_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_go_govet_checker") if exists('g:loaded_syntastic_go_govet_checker')
finish finish
endif endif
let g:loaded_syntastic_go_govet_checker = 1 let g:loaded_syntastic_go_govet_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_haml_haml_lint_checker") if exists('g:loaded_syntastic_haml_haml_lint_checker')
finish finish
endif endif
let g:loaded_syntastic_haml_haml_lint_checker = 1 let g:loaded_syntastic_haml_haml_lint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_handlebars_handlebars_checker") if exists('g:loaded_syntastic_handlebars_handlebars_checker')
finish finish
endif endif
let g:loaded_syntastic_handlebars_handlebars_checker = 1 let g:loaded_syntastic_handlebars_handlebars_checker = 1
@ -22,7 +22,7 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
let errorformat = let errorformat =
\ '%EError: %m on line %l:,' . \ '%EError: %m on line %l:,' .
\ "%EError: %m,". \ '%EError: %m,' .
\ '%Z%p^,' . \ '%Z%p^,' .
\ '%-G%.%#' \ '%-G%.%#'
@ -30,7 +30,7 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'postprocess': ['guards'], \ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr("")} }) \ 'defaults': {'bufnr': bufnr('')} })
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -30,10 +30,10 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
" know the version in order to know how to find out the version. :) " know the version in order to know how to find out the version. :)
" Try "ghc-mod version". " Try "ghc-mod version".
let ver = filter(split(system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''') let ver = filter(split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''')
if !len(ver) if !len(ver)
" That didn't work. Try "ghc-mod" alone. " That didn't work. Try "ghc-mod" alone.
let ver = filter(split(system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''') let ver = filter(split(syntastic#util#system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''')
endif endif
if len(ver) if len(ver)
@ -68,6 +68,7 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'preprocess': 'iconv',
\ 'postprocess': ['compressWhitespace'], \ 'postprocess': ['compressWhitespace'],
\ 'returns': [0] }) \ 'returns': [0] })
endfunction endfunction

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_haskell_hdevtools_checker") if exists('g:loaded_syntastic_haskell_hdevtools_checker')
finish finish
endif endif
let g:loaded_syntastic_haskell_hdevtools_checker = 1 let g:loaded_syntastic_haskell_hdevtools_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_haxe_haxe_checker") if exists('g:loaded_syntastic_haxe_haxe_checker')
finish finish
endif endif
let g:loaded_syntastic_haxe_haxe_checker = 1 let g:loaded_syntastic_haxe_haxe_checker = 1
@ -30,7 +30,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
call self.log('hxml =', hxml) call self.log('hxml =', hxml)
if hxml != '' if hxml !=# ''
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) }) \ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')) })

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_hss_hss_checker") if exists('g:loaded_syntastic_hss_hss_checker')
finish finish
endif endif
let g:loaded_syntastic_hss_hss_checker = 1 let g:loaded_syntastic_hss_hss_checker = 1

@ -9,16 +9,8 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
" "
"============================================================================ "============================================================================
"
" Note: if you need to check HTML5 sources, you might consider installing a
" fork of HTML Tidy, named "HTML Tidy for HTML5":
"
" http://w3c.github.io/tidy-html5/
"
" HTML Tidy for HTML5 can be used without changes by this checker, just install
" it and point g:syntastic_html_tidy_exec to the executable.
if exists("g:loaded_syntastic_html_tidy_checker") if exists('g:loaded_syntastic_html_tidy_checker')
finish finish
endif endif
let g:loaded_syntastic_html_tidy_checker = 1 let g:loaded_syntastic_html_tidy_checker = 1
@ -102,40 +94,40 @@ let s:IGNORE_ERRORS = [
lockvar! s:IGNORE_ERRORS lockvar! s:IGNORE_ERRORS
let s:BLOCKLEVEL_TAGS = [ let s:BLOCKLEVEL_TAGS = [
\ "main", \ 'main',
\ "section", \ 'section',
\ "article", \ 'article',
\ "aside", \ 'aside',
\ "header", \ 'header',
\ "footer", \ 'footer',
\ "nav", \ 'nav',
\ "figure", \ 'figure',
\ "figcaption" \ 'figcaption'
\ ] \ ]
lockvar! s:BLOCKLEVEL_TAGS lockvar! s:BLOCKLEVEL_TAGS
let s:INLINE_TAGS = [ let s:INLINE_TAGS = [
\ "video", \ 'video',
\ "audio", \ 'audio',
\ "source", \ 'source',
\ "embed", \ 'embed',
\ "mark", \ 'mark',
\ "progress", \ 'progress',
\ "meter", \ 'meter',
\ "time", \ 'time',
\ "ruby", \ 'ruby',
\ "rt", \ 'rt',
\ "rp", \ 'rp',
\ "canvas", \ 'canvas',
\ "command", \ 'command',
\ "details", \ 'details',
\ "datalist" \ 'datalist'
\ ] \ ]
lockvar! s:INLINE_TAGS lockvar! s:INLINE_TAGS
let s:EMPTY_TAGS = [ let s:EMPTY_TAGS = [
\ "wbr", \ 'wbr',
\ "keygen" \ 'keygen'
\ ] \ ]
lockvar! s:EMPTY_TAGS lockvar! s:EMPTY_TAGS
@ -152,7 +144,7 @@ function! SyntaxCheckers_html_tidy_GetLocList() dict " {{{1
let loclist = SyntasticMake({ let loclist = SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")}, \ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0, 1, 2] }) \ 'returns': [0, 1, 2] })
" filter out valid HTML5 from the errors " filter out valid HTML5 from the errors

@ -10,13 +10,13 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_html_validator_checker") if exists('g:loaded_syntastic_html_validator_checker')
finish finish
endif endif
let g:loaded_syntastic_html_validator_checker=1 let g:loaded_syntastic_html_validator_checker=1
if !exists('g:syntastic_html_validator_api') if !exists('g:syntastic_html_validator_api')
let g:syntastic_html_validator_api = 'http://validator.nu/' let g:syntastic_html_validator_api = 'https://validator.nu/'
endif endif
if !exists('g:syntastic_html_validator_parser') if !exists('g:syntastic_html_validator_parser')
@ -32,9 +32,9 @@ set cpo&vim
function! SyntaxCheckers_html_validator_GetLocList() dict function! SyntaxCheckers_html_validator_GetLocList() dict
let fname = syntastic#util#shexpand('%') let fname = syntastic#util#shexpand('%')
let makeprg = self.getExecEscaped() . ' -q -s --compressed -F out=gnu -F asciiquotes=yes' . let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' .
\ (g:syntastic_html_validator_parser != '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
\ (g:syntastic_html_validator_nsfilter != '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . \ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
\ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api \ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api
let errorformat = let errorformat =

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_html_w3_checker") if exists('g:loaded_syntastic_html_w3_checker')
finish finish
endif endif
let g:loaded_syntastic_html_w3_checker = 1 let g:loaded_syntastic_html_w3_checker = 1
@ -23,7 +23,7 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_html_w3_GetLocList() dict function! SyntaxCheckers_html_w3_GetLocList() dict
let makeprg = self.getExecEscaped() . ' -q -s -F output=json ' . let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' .
\ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' .
\ g:syntastic_html_w3_api \ g:syntastic_html_w3_api
@ -41,7 +41,7 @@ function! SyntaxCheckers_html_w3_GetLocList() dict
let loclist = SyntasticMake({ let loclist = SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")}, \ 'defaults': {'bufnr': bufnr('')},
\ 'returns': [0] }) \ 'returns': [0] })
for e in loclist for e in loclist

@ -11,16 +11,16 @@
" Tested with checkstyle 5.5 " Tested with checkstyle 5.5
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_java_checkstyle_checker") if exists('g:loaded_syntastic_java_checkstyle_checker')
finish finish
endif endif
let g:loaded_syntastic_java_checkstyle_checker = 1 let g:loaded_syntastic_java_checkstyle_checker = 1
if !exists("g:syntastic_java_checkstyle_classpath") 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-5.5-all.jar'
endif endif
if !exists("g:syntastic_java_checkstyle_conf_file") if !exists('g:syntastic_java_checkstyle_conf_file')
let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml' let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml'
endif endif
@ -46,7 +46,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) ) let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
if has('win32unix') if has('win32unix')
let fname = substitute(system('cygpath -m ' . fname), '\m\%x00', '', 'g') let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
endif endif
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({

@ -103,7 +103,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
let javac_classpath = '' let javac_classpath = ''
for path in split(g:syntastic_java_javac_classpath, s:ClassSep()) for path in split(g:syntastic_java_javac_classpath, s:ClassSep())
if path != '' if path !=# ''
try try
let ps = glob(path, 1, 1) let ps = glob(path, 1, 1)
catch catch
@ -128,8 +128,8 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
" }}}2 " }}}2
" load custom classpath {{{2 " load custom classpath {{{2
if g:syntastic_java_javac_custom_classpath_command != '' if g:syntastic_java_javac_custom_classpath_command !=# ''
let lines = system(g:syntastic_java_javac_custom_classpath_command) let lines = syntastic#util#system(g:syntastic_java_javac_custom_classpath_command)
if syntastic#util#isRunningWindows() || has('win32unix') if syntastic#util#isRunningWindows() || has('win32unix')
let lines = substitute(lines, "\r\n", "\n", 'g') let lines = substitute(lines, "\r\n", "\n", 'g')
endif endif
@ -138,7 +138,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
endfor endfor
endif endif
if javac_classpath != '' if javac_classpath !=# ''
let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath) let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath)
endif endif
" }}}2 " }}}2
@ -146,7 +146,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
let fname = expand('%:p:h', 1) . syntastic#util#Slash() . expand ('%:t', 1) let fname = expand('%:p:h', 1) . syntastic#util#Slash() . expand ('%:t', 1)
if has('win32unix') if has('win32unix')
let fname = s:CygwinPath(fname) let fname = syntastic#util#CygwinPath(fname)
endif endif
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
@ -155,14 +155,14 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
" unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types
let errorformat = let errorformat =
\ '%E%f:%l:\ error:\ %m,'. \ '%E%f:%l: error: %m,'.
\ '%W%f:%l:\ warning:\ %m,'. \ '%W%f:%l: warning: %m,'.
\ '%A%f:%l:\ %m,'. \ '%A%f:%l: %m,'.
\ '%+Z%p^,'. \ '%+Z%p^,'.
\ '%+C%.%#,'. \ '%+C%.%#,'.
\ '%-G%.%#' \ '%-G%.%#'
if output_dir != '' if output_dir !=# ''
silent! call mkdir(output_dir, 'p') silent! call mkdir(output_dir, 'p')
endif endif
let errors = SyntasticMake({ let errors = SyntasticMake({
@ -170,7 +170,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'postprocess': ['cygwinRemoveCR'] }) \ 'postprocess': ['cygwinRemoveCR'] })
if output_dir != '' if output_dir !=# ''
call syntastic#util#rmrf(output_dir) call syntastic#util#rmrf(output_dir)
endif endif
return errors return errors
@ -179,10 +179,6 @@ endfunction " }}}1
" Utilities {{{1 " Utilities {{{1
function! s:CygwinPath(path) " {{{2
return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
endfunction " }}}2
function! s:RemoveCarriageReturn(line) " {{{2 function! s:RemoveCarriageReturn(line) " {{{2
return substitute(a:line, "\r", '', 'g') return substitute(a:line, "\r", '', 'g')
endfunction " }}}2 endfunction " }}}2
@ -192,10 +188,10 @@ function! s:ClassSep() " {{{2
endfunction " }}}2 endfunction " }}}2
function! s:AddToClasspath(classpath, path) " {{{2 function! s:AddToClasspath(classpath, path) " {{{2
if a:path == '' if a:path ==# ''
return a:classpath return a:classpath
endif endif
return (a:classpath != '') ? a:classpath . s:ClassSep() . a:path : a:path return (a:classpath !=# '') ? a:classpath . s:ClassSep() . a:path : a:path
endfunction " }}}2 endfunction " }}}2
function! s:SplitClasspath(classpath) " {{{2 function! s:SplitClasspath(classpath) " {{{2
@ -303,14 +299,14 @@ endfunction " }}}2
function! s:GetMavenProperties() " {{{2 function! s:GetMavenProperties() " {{{2
let mvn_properties = {} let mvn_properties = {}
let pom = findfile('pom.xml', '.;') let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
if s:has_maven && filereadable(pom) if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
\ ' -f ' . syntastic#util#shescape(pom) . \ ' -f ' . syntastic#util#shescape(pom) .
\ ' ' . g:syntastic_java_maven_options \ ' ' . g:syntastic_java_maven_options
let mvn_is_managed_tag = 1 let mvn_is_managed_tag = 1
let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") let mvn_settings_output = split(syntastic#util#system(mvn_cmd . ' help:effective-pom'), "\n")
let current_path = 'project' let current_path = 'project'
for line in mvn_settings_output for line in mvn_settings_output
let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$') let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$')
@ -338,13 +334,13 @@ function! s:GetMavenProperties() " {{{2
endfunction " }}}2 endfunction " }}}2
function! s:GetMavenClasspath() " {{{2 function! s:GetMavenClasspath() " {{{2
let pom = findfile('pom.xml', '.;') let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
if s:has_maven && filereadable(pom) 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) 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) . let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
\ ' -f ' . syntastic#util#shescape(pom) . \ ' -f ' . syntastic#util#shescape(pom) .
\ ' ' . g:syntastic_java_maven_options \ ' ' . g:syntastic_java_maven_options
let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath'), "\n")
let mvn_classpath = '' let mvn_classpath = ''
let class_path_next = 0 let class_path_next = 0
@ -360,13 +356,14 @@ function! s:GetMavenClasspath() " {{{2
let mvn_properties = s:GetMavenProperties() let mvn_properties = s:GetMavenProperties()
let output_dir = 'target/classes' let sep = syntastic#util#Slash()
let output_dir = join(['target', 'classes'], sep)
if has_key(mvn_properties, 'project.build.outputDirectory') if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory'] let output_dir = mvn_properties['project.build.outputDirectory']
endif endif
let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir) let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir)
let test_output_dir = 'target/test-classes' let test_output_dir = join(['target', 'test-classes'], sep)
if has_key(mvn_properties, 'project.build.testOutputDirectory') if has_key(mvn_properties, 'project.build.testOutputDirectory')
let test_output_dir = mvn_properties['project.build.testOutputDirectory'] let test_output_dir = mvn_properties['project.build.testOutputDirectory']
endif endif
@ -381,28 +378,30 @@ function! s:GetMavenClasspath() " {{{2
endfunction " }}}2 endfunction " }}}2
function! s:MavenOutputDirectory() " {{{2 function! s:MavenOutputDirectory() " {{{2
let pom = findfile('pom.xml', '.;') let pom = findfile('pom.xml', escape(expand('%:p:h', 1), ' ') . ';')
if s:has_maven && filereadable(pom) if s:has_maven && filereadable(pom)
let mvn_properties = s:GetMavenProperties() let mvn_properties = s:GetMavenProperties()
let output_dir = getcwd() let output_dir = getcwd()
if has_key(mvn_properties, 'project.properties.build.dir') if has_key(mvn_properties, 'project.properties.build.dir')
let output_dir = mvn_properties['project.properties.build.dir'] let output_dir = mvn_properties['project.properties.build.dir']
endif endif
if stridx(expand('%:p:h', 1), 'src.main.java') >= 0
let output_dir .= '/target/classes' 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') if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory'] let output_dir = mvn_properties['project.build.outputDirectory']
endif endif
endif endif
if stridx(expand('%:p:h', 1), 'src.test.java') >= 0 if stridx(expand('%:p:h', 1), join(['src', 'test', 'java'], sep)) >= 0
let output_dir .= '/target/test-classes' let output_dir = join([output_dir, 'target', 'test-classes'], sep)
if has_key(mvn_properties, 'project.build.testOutputDirectory') if has_key(mvn_properties, 'project.build.testOutputDirectory')
let output_dir = mvn_properties['project.build.testOutputDirectory'] let output_dir = mvn_properties['project.build.testOutputDirectory']
endif endif
endif endif
if has('win32unix') if has('win32unix')
let output_dir = s:CygwinPath(output_dir) let output_dir = syntastic#util#CygwinPath(output_dir)
endif endif
return output_dir return output_dir
endif endif

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_javascript_closurecompiler_checker") if exists('g:loaded_syntastic_javascript_closurecompiler_checker')
finish finish
endif endif
let g:loaded_syntastic_javascript_closurecompiler_checker = 1 let g:loaded_syntastic_javascript_closurecompiler_checker = 1

@ -21,9 +21,20 @@ endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_javascript_flow_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 6])
endfunction
function! SyntaxCheckers_javascript_flow_GetLocList() dict function! SyntaxCheckers_javascript_flow_GetLocList() dict
if findfile('.flowconfig', escape(expand('%:p:h', 1), ' ') . ';') ==# ''
return []
endif
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'exe_after': 'check', \ 'exe': self.getExecEscaped() . ' status',
\ 'args_after': '--show-all-errors --json' }) \ 'args_after': '--show-all-errors --json' })
let errorformat = let errorformat =

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_javascript_gjslint_checker") if exists('g:loaded_syntastic_javascript_gjslint_checker')
finish finish
endif endif
let g:loaded_syntastic_javascript_gjslint_checker = 1 let g:loaded_syntastic_javascript_gjslint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_javascript_jscs_checker") if exists('g:loaded_syntastic_javascript_jscs_checker')
finish finish
endif endif
let g:loaded_syntastic_javascript_jscs_checker = 1 let g:loaded_syntastic_javascript_jscs_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_javascript_jsl_checker") if exists('g:loaded_syntastic_javascript_jsl_checker')
finish finish
endif endif
let g:loaded_syntastic_javascript_jsl_checker = 1 let g:loaded_syntastic_javascript_jsl_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_javascript_jslint_checker") if exists('g:loaded_syntastic_javascript_jslint_checker')
finish finish
endif endif
@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
if term != '' if term !=# ''
let term = '\V\<' . escape(term, '\') . '\>' let term = '\V\<' . escape(term, '\') . '\>'
endif endif
return term return term
@ -38,7 +38,7 @@ function! SyntaxCheckers_javascript_jslint_GetLocList() dict
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} }) \ 'defaults': {'bufnr': bufnr('')} })
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -18,7 +18,7 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
let jsxhint_version = system(self.getExecEscaped() . ' --version') let jsxhint_version = syntastic#util#system(self.getExecEscaped() . ' --version')
if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>') if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>')
return 0 return 0
endif endif

@ -0,0 +1,47 @@
"============================================================================
"File: standard.vim
"Description: JavaScript syntax checker - using standard
"Maintainer: LCD 47 <lcd047@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_javascript_standard_checker')
finish
endif
let g:loaded_syntastic_javascript_standard_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_standard_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 6, 1])
endfunction
function! SyntaxCheckers_javascript_standard_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args': '-v' })
let errorformat = ' %f:%l:%c: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'defaults': {'type': 'W'},
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'standard'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_json_jsonlint_checker") if exists('g:loaded_syntastic_json_jsonlint_checker')
finish finish
endif endif
let g:loaded_syntastic_json_jsonlint_checker = 1 let g:loaded_syntastic_json_jsonlint_checker = 1

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_json_jsonval_checker") if exists('g:loaded_syntastic_json_jsonval_checker')
finish finish
endif endif
let g:loaded_syntastic_json_jsonval_checker = 1 let g:loaded_syntastic_json_jsonval_checker = 1
@ -22,7 +22,7 @@ function! SyntaxCheckers_json_jsonval_GetLocList() dict
let makeprg = self.makeprgBuild({}) let makeprg = self.makeprgBuild({})
let errorformat = let errorformat =
\ '%E%f:\ %m\ at\ line\ %l,' . \ '%E%f: %m at line %l,' .
\ '%-G%.%#' \ '%-G%.%#'
return SyntasticMake({ return SyntasticMake({

@ -10,16 +10,16 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_less_lessc_checker") if exists('g:loaded_syntastic_less_lessc_checker')
finish finish
endif endif
let g:loaded_syntastic_less_lessc_checker = 1 let g:loaded_syntastic_less_lessc_checker = 1
if !exists("g:syntastic_less_options") if !exists('g:syntastic_less_options')
let g:syntastic_less_options = "" let g:syntastic_less_options = ''
endif endif
if !exists("g:syntastic_less_use_less_lint") if !exists('g:syntastic_less_use_less_lint')
let g:syntastic_less_use_less_lint = 0 let g:syntastic_less_use_less_lint = 0
endif endif
@ -53,7 +53,7 @@ function! SyntaxCheckers_less_lessc_GetLocList() dict
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'postprocess': ['guards'], \ 'postprocess': ['guards'],
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} }) \ 'defaults': {'bufnr': bufnr(''), 'text': 'Syntax error'} })
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_lex_flex_checker") if exists('g:loaded_syntastic_lex_flex_checker')
finish finish
endif endif
let g:loaded_syntastic_lex_flex_checker = 1 let g:loaded_syntastic_lex_flex_checker = 1
@ -21,12 +21,12 @@ set cpo&vim
function! SyntaxCheckers_lex_flex_GetHighlightRegex(item) function! SyntaxCheckers_lex_flex_GetHighlightRegex(item)
let term = matchstr(a:item['text'], let term = matchstr(a:item['text'],
\ '\m^\(unrecognized %option\|bad <start condition>\|bad character\( class expression\)\=\): \zs.*') \ '\m^\(unrecognized %option\|bad <start condition>\|bad character\( class expression\)\=\): \zs.*')
if term == '' if term ==# ''
let term = matchstr(a:item['text'], let term = matchstr(a:item['text'],
\ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze') \ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze')
endif endif
return term != '' ? '\V' . escape(term, '\') : '' return term !=# '' ? '\V' . escape(term, '\') : ''
endfunction endfunction
function! SyntaxCheckers_lex_flex_GetLocList() dict function! SyntaxCheckers_lex_flex_GetLocList() dict

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_limbo_limbo_checker") if exists('g:loaded_syntastic_limbo_limbo_checker')
finish finish
endif endif
let g:loaded_syntastic_limbo_limbo_checker = 1 let g:loaded_syntastic_limbo_limbo_checker = 1
@ -19,7 +19,7 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_limbo_limbo_GetLocList() dict function! SyntaxCheckers_limbo_limbo_GetLocList() dict
let include = $INFERNO_HOME != '' ? '-I$INFERNO_HOME ' : '' let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : ''
" don't generate .dis in current dir while checking syntax, " don't generate .dis in current dir while checking syntax,
" .dis should be generated by `mk` " .dis should be generated by `mk`
let output = filereadable('mkfile') ? (' ' . syntastic#c#NullOutput()) : '' let output = filereadable('mkfile') ? (' ' . syntastic#c#NullOutput()) : ''

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_lisp_clisp_checker") if exists('g:loaded_syntastic_lisp_clisp_checker')
finish finish
endif endif
let g:loaded_syntastic_lisp_clisp_checker = 1 let g:loaded_syntastic_lisp_clisp_checker = 1
@ -20,7 +20,7 @@ set cpo&vim
function! SyntaxCheckers_lisp_clisp_GetLocList() dict function! SyntaxCheckers_lisp_clisp_GetLocList() dict
let tmpdir = syntastic#util#tmpdir() let tmpdir = syntastic#util#tmpdir()
let out = tmpdir != '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : '' let out = tmpdir !=# '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : ''
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args_after': '-q', \ 'args_after': '-q',

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_llvm_llvm_checker") if exists('g:loaded_syntastic_llvm_llvm_checker')
finish finish
endif endif
let g:loaded_syntastic_llvm_llvm_checker = 1 let g:loaded_syntastic_llvm_llvm_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_lua_luac_checker") if exists('g:loaded_syntastic_lua_luac_checker')
finish finish
endif endif
let g:loaded_syntastic_lua_luac_checker = 1 let g:loaded_syntastic_lua_luac_checker = 1
@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
let result = '' let result = ''
let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''') let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''')
if near != '' if near !=# ''
if near ==# '<eof>' if near ==# '<eof>'
let p = getpos('$') let p = getpos('$')
let a:pos['lnum'] = p[1] let a:pos['lnum'] = p[1]

@ -9,7 +9,7 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_lua_luacheck_checker") if exists('g:loaded_syntastic_lua_luacheck_checker')
finish finish
endif endif
let g:loaded_syntastic_lua_luacheck_checker = 1 let g:loaded_syntastic_lua_luacheck_checker = 1
@ -19,27 +19,27 @@ set cpo&vim
function! SyntaxCheckers_lua_luacheck_GetHighlightRegex(item) function! SyntaxCheckers_lua_luacheck_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m''\zs\S\+\ze''') let term = matchstr(a:item['text'], '\m''\zs\S\+\ze''')
if term != '' if term !=# ''
return '\V\<' . escape(term, '\') . '\>' return '\V\<' . escape(term, '\') . '\>'
endif endif
let term = matchstr(a:item['text'], '\m\(accessing undefined\|setting non-standard global\|' . let term = matchstr(a:item['text'], '\m\(accessing undefined\|setting non-standard global\|' .
\ 'setting non-module global\|unused global\) variable \zs\S\+') \ 'setting non-module global\|unused global\) variable \zs\S\+')
if term == '' if term ==# ''
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze was previously defined') let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze was previously defined')
endif endif
if term == '' if term ==# ''
let term = matchstr(a:item['text'], '\munused \(variable\|argument\|loop variable\) \zs\S\+') let term = matchstr(a:item['text'], '\munused \(variable\|argument\|loop variable\) \zs\S\+')
endif endif
if term == '' if term ==# ''
let term = matchstr(a:item['text'], '\m\(value assigned to variable\|value of argument\|' . let term = matchstr(a:item['text'], '\m\(value assigned to variable\|value of argument\|' .
\ 'value of loop variable\) \zs\S\+') \ 'value of loop variable\) \zs\S\+')
endif endif
if term == '' if term ==# ''
let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze is never set') let term = matchstr(a:item['text'], '\mvariable \zs\S\+\ze is never set')
endif endif
return term != '' ? '\V\<' . escape(term, '\') . '\>' : '' return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction endfunction
function! SyntaxCheckers_lua_luacheck_GetLocList() dict function! SyntaxCheckers_lua_luacheck_GetLocList() dict

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_markdown_mdl_checker") if exists('g:loaded_syntastic_markdown_mdl_checker')
finish finish
endif endif
let g:loaded_syntastic_markdown_mdl_checker = 1 let g:loaded_syntastic_markdown_mdl_checker = 1

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_matlab_mlint_checker") if exists('g:loaded_syntastic_matlab_mlint_checker')
finish finish
endif endif
let g:loaded_syntastic_matlab_mlint_checker = 1 let g:loaded_syntastic_matlab_mlint_checker = 1
@ -28,7 +28,7 @@ function! SyntaxCheckers_matlab_mlint_GetLocList() dict
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} }) \ 'defaults': {'bufnr': bufnr('')} })
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

@ -0,0 +1,49 @@
"============================================================================
"File: mercury.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Joshua Rahm (joshuarahm@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_mercury_mmc_checker')
finish
endif
let g:loaded_syntastic_mercury_mmc_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_mercury_mmc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '-e' })
let errorformat =
\ '%C%f:%l: %m,' .
\ '%E%f:%l: %m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
for e in loclist
if stridx(e['text'], ' warning:') >= 0
let e['type'] = 'W'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'mercury',
\ 'name': 'mmc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_nasm_nasm_checker") if exists('g:loaded_syntastic_nasm_nasm_checker')
finish finish
endif endif
let g:loaded_syntastic_nasm_nasm_checker = 1 let g:loaded_syntastic_nasm_nasm_checker = 1
@ -21,7 +21,7 @@ set cpo&vim
function! SyntaxCheckers_nasm_nasm_GetLocList() dict function! SyntaxCheckers_nasm_nasm_GetLocList() dict
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args_after': '-X gnu -f elf' . \ 'args_after': '-X gnu -f elf' .
\ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . '/') . \ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . syntastic#util#Slash()) .
\ ' ' . syntastic#c#NullOutput() }) \ ' ' . syntastic#c#NullOutput() })
let errorformat = '%f:%l: %t%*[^:]: %m' let errorformat = '%f:%l: %t%*[^:]: %m'

@ -0,0 +1,44 @@
"============================================================================
"File: nix.vim
"Description: Check nix syntax using 'nix-instantiate --eval-only'
"Maintainer: Tim Cuthbertson <tim@gfxmonk.net>
"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_nix_nix_checker')
finish
endif
let g:loaded_syntastic_nix_nix_checker = 1
let s:save_cpo = &cpo
set cpo&vim
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'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nix',
\ 'name': 'nix',
\ 'exec': 'nix-instantiate' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

@ -10,7 +10,7 @@
" "
"============================================================================ "============================================================================
if exists("g:loaded_syntastic_nroff_mandoc_checker") if exists('g:loaded_syntastic_nroff_mandoc_checker')
finish finish
endif endif
let g:loaded_syntastic_nroff_mandoc_checker = 1 let g:loaded_syntastic_nroff_mandoc_checker = 1

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save