diff --git a/autoload/syntastic/makeprg.vim b/autoload/syntastic/makeprg.vim index b032e123..4d7a0331 100644 --- a/autoload/syntastic/makeprg.vim +++ b/autoload/syntastic/makeprg.vim @@ -17,13 +17,17 @@ let g:loaded_syntastic_makeprg_autoload = 1 " \ 'args': '-a -b -c', " \ 'post_args': '--more --args', " \ 'tail': '> /tmp/output', +" \ 'filetype': 'ruby', " \ 'subchecker': 'mri' }) " "Note that the current filename is added by default - but can be overridden by "passing in an 'fname' arg. " -"All options can be overriden by the user with global variables - even when -"not specified by the checker in syntastic#makeprg#build(). +"Arguments 'filetype' and 'subchecker' are mandatory, handling of composite +"types and user-defined variables breaks if you omit them. +" +"All other options can be overriden by the user with global variables - even +"when not specified by the checker in syntastic#makeprg#build(). " "E.g. They could override the checker exe with " diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 5a43f6bf..a33b9325 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -175,7 +175,7 @@ variable to 0. > *'syntastic_echo_current_error'* Default: 1 -If enabled, syntastic will echo the errror associated with the current line to +If enabled, syntastic will echo the error associated with the current line to the command window. If multiple errors are found, the first will be used. > let g:syntastic_echo_current_error=1 < @@ -395,11 +395,14 @@ Checkers that use 'syntastic#makeprg#build()' look like this: > \ 'args': '-a -b -c', \ 'post_args': '--more --args', \ 'tail': '> /tmp/output', + \ 'filetype': 'ruby', \ 'subchecker': 'mri' }) < -All of the parameters above can be overriden by setting global variables - -even parameters not specified in the call to syntastic#makeprg#build(). +The 'filetype' and 'subchecker' parameters are mandatory. All of the other +parameters above are optional (well, you probably need at least 'exe'), and +can be overriden by setting global variables - even parameters not specified +in the call to syntastic#makeprg#build(). E.g. To override the checker exe above, you could do this: > let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 3390734c..c49d7c26 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -9,18 +9,23 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ +" +" Note: this script requires CoffeeScript version 1.6.2 or newer. +" if exists("g:loaded_syntastic_coffee_coffee_checker") finish endif let g:loaded_syntastic_coffee_coffee_checker=1 function! SyntaxCheckers_coffee_coffee_IsAvailable() - return executable("coffee") + return executable("coffee") && + \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>/dev/null'), [1,6,2]) endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', + \ 'args': '-cp', \ 'filetype': 'coffee', \ 'subchecker': 'coffee' }) diff --git a/syntax_checkers/go/golint.vim b/syntax_checkers/go/golint.vim new file mode 100644 index 00000000..954a7c2a --- /dev/null +++ b/syntax_checkers/go/golint.vim @@ -0,0 +1,37 @@ +"============================================================================ +"File: golint.vim +"Description: Check go syntax using 'golint' +"Maintainer: Hiroshi Ioka +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +if exists("g:loaded_syntastic_go_golint_checker") + finish +endif +let g:loaded_syntastic_go_golint_checker=1 + +function! SyntaxCheckers_go_golint_IsAvailable() + return executable('golint') +endfunction + +function! SyntaxCheckers_go_golint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'golint', + \ 'filetype': 'go', + \ 'subchecker': 'golint' }) + + let errorformat = '%f:%l:%c: %m,%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'go', + \ 'name': 'golint'}) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 957dd6ee..0f528026 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -63,7 +63,7 @@ let s:ignore_html_errors = [ \ " attribute \"type\" has invalid value \"search\"" \ ] -function! s:IgnoreErrror(text) +function! s:IgnoreError(text) for i in s:ignore_html_errors + g:syntastic_html_tidy_ignore_errors if stridx(a:text, i) != -1 return 1 @@ -101,7 +101,7 @@ function! SyntaxCheckers_html_tidy_GetLocList() " filter out valid HTML5 from the errors for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreErrror(loclist[n]['text']) == 1 + if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 let loclist[n]['valid'] = 0 endif endfor diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 9431e568..72e4de93 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -47,7 +47,7 @@ function! s:TidyEncOptByFenc() return get(tidy_opts, &fileencoding, '-utf8') endfunction -function! s:IgnoreErrror(text) +function! s:IgnoreError(text) for i in g:syntastic_xhtml_tidy_ignore_errors if stridx(a:text, i) != -1 return 1 @@ -75,7 +75,7 @@ function! SyntaxCheckers_xhtml_tidy_GetLocList() \ 'defaults': {'bufnr': bufnr("")} }) for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreErrror(loclist[n]['text']) == 1 + if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 let loclist[n]['valid'] = 0 endif endfor