Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Braid: Update mirror 'bundle/syntastic' to 'e961f17'

  • Loading branch information...
commit 96636a5821397cfbacc56ed5c550880089454954 1 parent 269a1ba
@baphled authored
Showing with 504 additions and 181 deletions.
  1. +1 −1  .braids
  2. +11 −1 bundle/syntastic/README.markdown
  3. +63 −0 bundle/syntastic/autoload/syntastic/c.vim
  4. +50 −38 bundle/syntastic/plugin/syntastic.vim
  5. +24 −33 bundle/syntastic/syntax_checkers/c.vim
  6. +48 −7 bundle/syntastic/syntax_checkers/cpp.vim
  7. +1 −1  bundle/syntastic/syntax_checkers/go.vim
  8. +7 −2 bundle/syntastic/syntax_checkers/haskell.vim
  9. +1 −1  bundle/syntastic/syntax_checkers/javascript.vim
  10. +1 −4 bundle/syntastic/syntax_checkers/javascript/jslint.vim
  11. +1 −1  bundle/syntastic/syntax_checkers/json.vim
  12. +4 −7 bundle/syntastic/syntax_checkers/lua.vim
  13. +32 −0 bundle/syntastic/syntax_checkers/nasm.vim
  14. +5 −5 bundle/syntastic/syntax_checkers/php.vim
  15. +44 −7 bundle/syntastic/syntax_checkers/puppet.vim
  16. +3 −56 bundle/syntastic/syntax_checkers/python.vim
  17. +31 −0 bundle/syntastic/syntax_checkers/python/flake8.vim
  18. +34 −0 bundle/syntastic/syntax_checkers/python/pyflakes.vim
  19. +14 −0 bundle/syntastic/syntax_checkers/python/pylint.vim
  20. +1 −1  bundle/syntastic/syntax_checkers/rst.vim
  21. +8 −10 bundle/syntastic/syntax_checkers/ruby.vim
  22. +16 −0 bundle/syntastic/syntax_checkers/ruby/jruby.vim
  23. +22 −0 bundle/syntastic/syntax_checkers/ruby/mri.vim
  24. +33 −0 bundle/syntastic/syntax_checkers/scala.vim
  25. +18 −6 bundle/syntastic/syntax_checkers/vala.vim
  26. +31 −0 bundle/syntastic/syntax_checkers/z80.vim
View
2  .braids
@@ -107,7 +107,7 @@ bundle/surround:
bundle/syntastic:
branch: master
remote: master/braid/bundles/syntastic
- revision: b4a7d4729447f1c912eca390f3e4c9d9d98e62ef
+ revision: e961f17c7c19c9888e16f714b37085e0cb833111
squashed: true
type: git
url: git://github.com/scrooloose/syntastic.git
View
12 bundle/syntastic/README.markdown
@@ -55,7 +55,7 @@ Installation
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
-Then reload vim, run `:helptags`, and check out `:help syntastic.txt`.
+Then reload vim, run `:Helptags`, and check out `:help syntastic.txt`.
Google group
@@ -64,6 +64,16 @@ Google group
To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic).
+FAQ
+---
+
+__Q. I installed syntastic but it isn't reporting any errors ...__
+
+A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/<filetype>.vim`.
+
+Another reason it could fail is that the error output for the 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 create an issue - or better yet, create a pull request.
+
+
Changelog
---------
2.3.0 (16-feb-2012)
View
63 bundle/syntastic/autoload/syntastic/c.vim
@@ -38,6 +38,69 @@ function! s:Init()
call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', [])
endfunction
+" default include directories
+let s:default_includes = [ '.', '..', 'include', 'includes',
+ \ '../include', '../includes' ]
+
+" uniquify the input list
+function! s:Unique(list)
+ let l = []
+ for elem in a:list
+ if index(l, elem) == -1
+ let l = add(l, elem)
+ endif
+ endfor
+ return l
+endfunction
+
+" get the gcc include directory argument depending on the default
+" includes and the optional user-defined 'g:syntastic_c_include_dirs'
+function! syntastic#c#GetIncludeDirs(filetype)
+ let include_dirs = copy(s:default_includes)
+
+ if exists('g:syntastic_'.a:filetype.'_include_dirs')
+ call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs)
+ endif
+
+ return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ')
+endfunction
+
+" read additional compiler flags from the given configuration file
+" the file format and its parsing mechanism is inspired by clang_complete
+function! syntastic#c#ReadConfig(file)
+ " search in the current file's directory upwards
+ let config = findfile(a:file, '.;')
+ if config == '' || !filereadable(config) | return '' | endif
+
+ " convert filename into absolute path
+ let filepath = substitute(fnamemodify(config, ':p:h'), '\', '/', 'g')
+
+ " try to read config file
+ try
+ let lines = map(readfile(config),
+ \ 'substitute(v:val, ''\'', ''/'', ''g'')')
+ catch /E484/
+ return ''
+ endtry
+
+ let parameters = []
+ for line in lines
+ let matches = matchlist(line, '^\s*-I\s*\(\S\+\)')
+ if matches != [] && matches[1] != ''
+ " this one looks like an absolute path
+ if match(matches[1], '^\%(/\|\a:\)') != -1
+ call add(parameters, '-I' . matches[1])
+ else
+ call add(parameters, '-I' . filepath . '/' . matches[1])
+ endif
+ else
+ call add(parameters, line)
+ endif
+ endfor
+
+ return join(parameters, ' ')
+endfunction
+
" search the first 100 lines for include statements that are
" given in the handlers dictionary
function! syntastic#c#SearchHeaders()
View
88 bundle/syntastic/plugin/syntastic.vim
@@ -127,6 +127,10 @@ function! s:UpdateErrors(auto_invoked)
call s:RefreshSigns()
endif
+ if g:syntastic_enable_highlighting
+ call s:HightlightErrors()
+ endif
+
if g:syntastic_auto_jump && s:BufHasErrorsOrWarningsToDisplay()
silent! ll
endif
@@ -350,6 +354,43 @@ function! s:ShowLocList()
endif
endfunction
+"highlight the current errors using matchadd()
+"
+"The function `Syntastic_{&ft}_GetHighlightRegex` is used to get the regex to
+"highlight errors that do not have a 'col' key (and hence cant be done
+"automatically). This function must take one arg (an error item) and return a
+"regex to match that item in the buffer.
+"
+"If the 'force_highlight_callback' key is set for an error item, then invoke
+"the callback even if it can be highlighted automatically.
+function! s:HightlightErrors()
+ call s:ClearErrorHighlights()
+
+ let fts = substitute(&ft, '-', '_', 'g')
+ for ft in split(fts, '\.')
+
+ for item in s:LocList()
+
+ let force_callback = has_key(item, 'force_highlight_callback') && item['force_highlight_callback']
+
+ let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
+ if get( item, 'col' ) && !force_callback
+ let lastcol = col([item['lnum'], '$'])
+ let lcol = min([lastcol, item['col']])
+ call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c')
+ else
+
+ if exists("*SyntaxCheckers_". ft ."_GetHighlightRegex")
+ let term = SyntaxCheckers_{ft}_GetHighlightRegex(item)
+ if len(term) > 0
+ call matchadd(group, '\%' . item['lnum'] . 'l' . term)
+ endif
+ endif
+ endif
+ endfor
+ endfor
+endfunction
+
"remove all error highlights from the window
function! s:ClearErrorHighlights()
for match in getmatches()
@@ -425,8 +466,8 @@ endfunction
"load the chosen checker for the current filetype - useful for filetypes like
"javascript that have more than one syntax checker
-function! s:LoadChecker(checker)
- exec "runtime syntax_checkers/" . &ft . "/" . a:checker . ".vim"
+function! s:LoadChecker(checker, ft)
+ exec "runtime syntax_checkers/" . a:ft . "/" . a:checker . ".vim"
endfunction
"return a string representing the state of buffer according to
@@ -541,37 +582,6 @@ function! SyntasticErrorBalloonExpr()
return get(b:syntastic_balloons, v:beval_lnum, '')
endfunction
-"highlight the list of errors (a:errors) using matchadd()
-"
-"a:termfunc is provided to highlight errors that do not have a 'col' key (and
-"hence cant be done automatically). This function must take one arg (an error
-"item) and return a regex to match that item in the buffer.
-"
-"an optional boolean third argument can be provided to force a:termfunc to be
-"used regardless of whether a 'col' key is present for the error
-function! SyntasticHighlightErrors(errors, termfunc, ...)
- if !g:syntastic_enable_highlighting
- return
- endif
-
- call s:ClearErrorHighlights()
-
- let force_callback = a:0 && a:1
- for item in a:errors
- let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
- if item['col'] && !force_callback
- let lastcol = col([item['lnum'], '$'])
- let lcol = min([lastcol, item['col']])
- call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c')
- else
- let term = a:termfunc(item)
- if len(term) > 0
- call matchadd(group, '\%' . item['lnum'] . 'l' . term)
- endif
- endif
- endfor
-endfunction
-
"take a list of errors and add default values to them from a:options
function! SyntasticAddToErrors(errors, options)
for i in range(0, len(a:errors)-1)
@@ -592,22 +602,24 @@ endfunction
"well as the names of the actual syntax checker executables. The checkers
"should be listed in order of default preference.
"
-"if a option called 'g:syntastic_[filetype]_checker' exists then attempt to
+"a:ft should be the filetype for the checkers being loaded
+"
+"if a option called 'g:syntastic_{a:ft}_checker' exists then attempt to
"load the checker that it points to
-function! SyntasticLoadChecker(checkers)
- let opt_name = "g:syntastic_" . &ft . "_checker"
+function! SyntasticLoadChecker(checkers, ft)
+ let opt_name = "g:syntastic_" . a:ft . "_checker"
if exists(opt_name)
let opt_val = {opt_name}
if index(a:checkers, opt_val) != -1 && executable(opt_val)
- call s:LoadChecker(opt_val)
+ call s:LoadChecker(opt_val, a:ft)
else
echoerr &ft . " syntax not supported or not installed."
endif
else
for checker in a:checkers
if executable(checker)
- return s:LoadChecker(checker)
+ return s:LoadChecker(checker, a:ft)
endif
endfor
endif
View
57 bundle/syntastic/syntax_checkers/c.vim
@@ -46,6 +46,13 @@
"
" let g:syntastic_c_compiler_options = ' -ansi'
"
+" Additionally the setting 'g:syntastic_c_config_file' allows you to define a
+" file that contains additional compiler arguments like include directories or
+" CFLAGS. The file is expected to contain one option per line. If none is
+" given the filename defaults to '.syntastic_c_config':
+"
+" let g:syntastic_c_config_file = '.config'
+"
" Using the global variable 'g:syntastic_c_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_c_include_dirs'
" setting are removed from the result set:
@@ -64,56 +71,37 @@ endif
let s:save_cpo = &cpo
set cpo&vim
-" default include directories
-let s:default_includes = [ '.', '..', 'include', 'includes',
- \ '../include', '../includes' ]
-
-" uniquify the input list
-function! s:Unique(list)
- let l = []
- for elem in a:list
- if index(l, elem) == -1
- let l = add(l, elem)
- endif
- endfor
- return l
-endfunction
-
-" get the gcc include directory argument depending on the default
-" includes and the optional user-defined 'g:syntastic_c_include_dirs'
-function! s:GetIncludeDirs()
- let include_dirs = s:default_includes
-
- if exists('g:syntastic_c_include_dirs')
- call extend(include_dirs, g:syntastic_c_include_dirs)
- endif
+if !exists('g:syntastic_c_compiler_options')
+ let g:syntastic_c_compiler_options = '-std=gnu99'
+endif
- return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ')
-endfunction
+if !exists('g:syntastic_c_config_file')
+ let g:syntastic_c_config_file = '.syntastic_c_config'
+endif
function! SyntaxCheckers_c_GetLocList()
- let makeprg = 'gcc -fsyntax-only -std=gnu99 '.shellescape(expand('%')).
- \ ' '.s:GetIncludeDirs()
+ let makeprg = 'gcc -fsyntax-only '
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m'
+ " add optional user-defined compiler options
+ let makeprg .= g:syntastic_c_compiler_options
+
+ let makeprg .= ' '.shellescape(expand('%')).
+ \ ' '.syntastic#c#GetIncludeDirs('c')
+
" determine whether to parse header files as well
if expand('%') =~? '.h$'
if exists('g:syntastic_c_check_header')
let makeprg = 'gcc -c '.shellescape(expand('%')).
- \ ' '.s:GetIncludeDirs()
+ \ ' '.syntastic#c#GetIncludeDirs('c')
else
return []
endif
endif
- " add optional user-defined compiler options
- if exists('g:syntastic_c_compiler_options')
- let makeprg .= g:syntastic_c_compiler_options
- endif
-
" check if the user manually set some cflags
if !exists('b:syntastic_c_cflags')
" check whether to search for include files at all
@@ -136,6 +124,9 @@ function! SyntaxCheckers_c_GetLocList()
let makeprg .= b:syntastic_c_cflags
endif
+ " add optional config file parameters
+ let makeprg .= syntastic#c#ReadConfig(g:syntastic_c_config_file)
+
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
View
55 bundle/syntastic/syntax_checkers/cpp.vim
@@ -20,6 +20,12 @@
"
" let g:syntastic_cpp_no_include_search = 1
"
+" In order to add some custom include directories that should be added to the
+" gcc command line you can add those to the global variable
+" g:syntastic_cpp_include_dirs. This list can be used like this:
+"
+" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ]
+"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
@@ -39,6 +45,19 @@
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
"
" let g:syntastic_cpp_compiler_options = ' -std=c++0x'
+"
+" Additionally the setting 'g:syntastic_cpp_config_file' allows you to define
+" a file that contains additional compiler arguments like include directories
+" or CFLAGS. The file is expected to contain one option per line. If none is
+" given the filename defaults to '.syntastic_cpp_config':
+"
+" let g:syntastic_cpp_config_file = '.config'
+"
+" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can
+" specify whether errors of files included via the
+" g:syntastic_cpp_include_dirs' setting are removed from the result set:
+"
+" let g:syntastic_cpp_remove_include_errors = 1
if exists('loaded_cpp_syntax_checker')
finish
@@ -52,22 +71,30 @@ endif
let s:save_cpo = &cpo
set cpo&vim
+if !exists('g:syntastic_cpp_config_file')
+ let g:syntastic_cpp_config_file = '.syntastic_cpp_config'
+endif
+
function! SyntaxCheckers_cpp_GetLocList()
- let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%'))
+ let makeprg = 'g++ -fsyntax-only '
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
+ if exists('g:syntastic_cpp_compiler_options')
+ let makeprg .= g:syntastic_cpp_compiler_options
+ endif
+
+ let makeprg .= ' ' . shellescape(expand('%')) .
+ \ ' ' . syntastic#c#GetIncludeDirs('cpp')
+
if expand('%') =~? '\%(.h\|.hpp\|.hh\)$'
if exists('g:syntastic_cpp_check_header')
- let makeprg = 'g++ -c '.shellescape(expand('%'))
+ let makeprg = 'g++ -c '.shellescape(expand('%')).
+ \ ' ' . syntastic#c#GetIncludeDirs('cpp')
else
return []
endif
endif
- if exists('g:syntastic_cpp_compiler_options')
- let makeprg .= g:syntastic_cpp_compiler_options
- endif
-
if !exists('b:syntastic_cpp_cflags')
if !exists('g:syntastic_cpp_no_include_search') ||
\ g:syntastic_cpp_no_include_search != 1
@@ -85,7 +112,21 @@ function! SyntaxCheckers_cpp_GetLocList()
let makeprg .= b:syntastic_cpp_cflags
endif
- return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+ " add optional config file parameters
+ let makeprg .= syntastic#c#ReadConfig(g:syntastic_cpp_config_file)
+
+ " process makeprg
+ let errors = SyntasticMake({ 'makeprg': makeprg,
+ \ 'errorformat': errorformat })
+
+ " filter the processed errors if desired
+ if exists('g:syntastic_cpp_remove_include_errors') &&
+ \ g:syntastic_cpp_remove_include_errors != 0
+ return filter(errors,
+ \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
+ else
+ return errors
+ endif
endfunction
let &cpo = s:save_cpo
View
2  bundle/syntastic/syntax_checkers/go.vim
@@ -19,4 +19,4 @@ endif
let loaded_go_syntax_checker = 1
let s:supported_checkers = ["6g", "gofmt"]
-call SyntasticLoadChecker(s:supported_checkers)
+call SyntasticLoadChecker(s:supported_checkers, 'go')
View
9 bundle/syntastic/syntax_checkers/haskell.vim
@@ -19,11 +19,16 @@ if !executable("ghc-mod")
finish
endif
+if !exists('g:syntastic_haskell_checker_args')
+ let g:syntastic_haskell_checker_args = '--hlintOpt="--language=XmlSyntax"'
+endif
+
function! SyntaxCheckers_haskell_GetLocList()
+ let ghcmod = 'ghc-mod ' . g:syntastic_haskell_checker_args
let makeprg =
\ "{ ".
- \ "ghc-mod check ". shellescape(expand('%')) . "; " .
- \ "ghc-mod lint " . shellescape(expand('%')) . ";" .
+ \ ghcmod . " check ". shellescape(expand('%')) . "; " .
+ \ ghcmod . " lint " . shellescape(expand('%')) . ";" .
\ " }"
let errorformat = '%-G\\s%#,%f:%l:%c:%trror: %m,%f:%l:%c:%tarning: %m,'.
\ '%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: %m,%f:%l:%c:%m,'.
View
2  bundle/syntastic/syntax_checkers/javascript.vim
@@ -20,4 +20,4 @@ endif
let loaded_javascript_syntax_checker = 1
let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint"]
-call SyntasticLoadChecker(s:supported_checkers)
+call SyntasticLoadChecker(s:supported_checkers, 'javascript')
View
5 bundle/syntastic/syntax_checkers/javascript/jslint.vim
@@ -23,9 +23,6 @@ endfunction
function! SyntaxCheckers_javascript_GetLocList()
let makeprg = "jslint " . g:syntastic_javascript_jslint_conf . " " . shellescape(expand('%'))
let errorformat='%E %##%n %m,%-Z%.%#Line %l\, Pos %c,%-G%.%#'
- let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
- call SyntasticHighlightErrors(errors, function('SyntaxCheckers_javascript_HighlightTerm'))
-
- return errors
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
endfunction
View
2  bundle/syntastic/syntax_checkers/json.vim
@@ -20,4 +20,4 @@ endif
let loaded_json_syntax_checker = 1
let s:supported_checkers = ["jsonlint", "jsonval"]
-call SyntasticLoadChecker(s:supported_checkers)
+call SyntasticLoadChecker(s:supported_checkers, 'json')
View
11 bundle/syntastic/syntax_checkers/lua.vim
@@ -20,7 +20,7 @@ if !executable('luac')
finish
endif
-function! SyntaxCheckers_lua_Term(pos)
+function! SyntaxCheckers_lua_GetHighlightRegex(pos)
let near = matchstr(a:pos['text'], "near '[^']\\+'")
let result = ''
if len(near) > 0
@@ -47,12 +47,9 @@ function! SyntaxCheckers_lua_GetLocList()
let makeprg = 'luac -p ' . shellescape(expand('%'))
let errorformat = 'luac: %#%f:%l: %m'
- let loclist = SyntasticMake({ 'makeprg': makeprg,
- \ 'errorformat': errorformat,
- \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } })
+ return SyntasticMake({ 'makeprg': makeprg,
+ \ 'errorformat': errorformat,
+ \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } })
- call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_lua_Term"))
-
- return loclist
endfunction
View
32 bundle/syntastic/syntax_checkers/nasm.vim
@@ -0,0 +1,32 @@
+"============================================================================
+"File: nasm.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Maintainer: Håvard Pettersson <haavard.pettersson 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("loaded_nasm_syntax_checker")
+ finish
+endif
+let loaded_nasm_syntax_checker = 1
+
+"bail if the user doesnt have nasm installed
+if !executable("nasm")
+ finish
+endif
+
+function! SyntaxCheckers_nasm_GetLocList()
+ if has("win32")
+ let outfile="NUL"
+ else
+ let outfile="/dev/null"
+ endif
+ let wd = shellescape(expand("%:p:h") . "/")
+ let makeprg = "nasm -X gnu -f elf -I " . wd . " -o " . outfile . " " . shellescape(expand("%"))
+ let errorformat = '%f:%l: %t%*[^:]: %m'
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+endfunction
View
10 bundle/syntastic/syntax_checkers/php.vim
@@ -28,9 +28,11 @@ if !exists("g:syntastic_phpcs_disable")
let g:syntastic_phpcs_disable = 0
endif
-function! SyntaxCheckers_php_Term(item)
+function! SyntaxCheckers_php_GetHighlightRegex(item)
let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'")
- if len(unexpected) < 1 | return '' | end
+ if len(unexpected) < 1
+ return ''
+ endif
return '\V'.split(unexpected, "'")[1]
endfunction
@@ -38,7 +40,7 @@ function! SyntaxCheckers_php_GetLocList()
let errors = []
- let makeprg = "php -l ".shellescape(expand('%'))
+ let makeprg = "php -l -d error_reporting=E_ALL -d display_errors=0 -d error_log='' ".shellescape(expand('%'))
let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
@@ -46,8 +48,6 @@ function! SyntaxCheckers_php_GetLocList()
let errors = errors + s:GetPHPCSErrors()
endif
- call SyntasticHighlightErrors(errors, function('SyntaxCheckers_php_Term'))
-
return errors
endfunction
View
51 bundle/syntastic/syntax_checkers/puppet.vim
@@ -19,21 +19,46 @@ if !executable("puppet")
finish
endif
-function! s:ExtractVersion()
+if !exists("g:syntastic_puppet_lint_disable")
+ let g:syntastic_puppet_lint_disable = 0
+endif
+
+if !executable("puppet-lint")
+ let g:syntastic_puppet_lint_disable = 0
+endif
+
+function! s:PuppetExtractVersion()
let output = system("puppet --version")
let output = substitute(output, '\n$', '', '')
return split(output, '\.')
endfunction
-let s:puppetVersion = s:ExtractVersion()
+function! s:PuppetLintExtractVersion()
+ let output = system("puppet-lint --version")
+ let output = substitute(output, '\n$', '', '')
+ let output = substitute(output, '^puppet-lint ', '', 'i')
+ return split(output, '\.')
+endfunction
-function! SyntaxCheckers_puppet_GetLocList()
+let s:puppetVersion = s:PuppetExtractVersion()
+let s:lintVersion = s:PuppetLintExtractVersion()
+
+if !(s:lintVersion[0] >= '0' && s:lintVersion[1] >= '1' && s:lintVersion[2] >= '10')
+ let g:syntastic_puppet_lint_disable = 0
+endif
+
+function! s:getPuppetLintErrors()
+ let makeprg = 'puppet-lint --log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}" '.shellescape(expand('%'))
+ let errorformat = '%t%*[a-zA-Z] %m at %f:%l'
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' })
+endfunction
+
+function! s:getPuppetMakeprg()
"If puppet is >= version 2.7 then use the new executable
if s:puppetVersion[0] >= '2' && s:puppetVersion[1] >= '7'
let makeprg = 'puppet parser validate ' .
\ shellescape(expand('%')) .
- \ ' --color=false' .
- \ ' --storeconfigs'
+ \ ' --color=false'
"add --ignoreimport for versions < 2.7.10
if s:puppetVersion[2] < '10'
@@ -43,12 +68,24 @@ function! SyntaxCheckers_puppet_GetLocList()
else
let makeprg = 'puppet --color=false --parseonly --ignoreimport '.shellescape(expand('%'))
endif
+ return makeprg
+endfunction
+
+function! SyntaxCheckers_puppet_GetLocList()
+
+ let makeprg = s:getPuppetMakeprg()
"some versions of puppet (e.g. 2.7.10) output the message below if there
"are any syntax errors
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
-
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
- return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+ let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+
+ if !g:syntastic_puppet_lint_disable
+ let errors = errors + s:getPuppetLintErrors()
+ endif
+
+ return errors
endfunction
+
View
59 bundle/syntastic/syntax_checkers/python.vim
@@ -6,75 +6,22 @@
" kstep <me@kstep.me>
" Parantapa Bhattacharya <parantapa@gmail.com>
"
-"============================================================================
"
" For forcing the use of flake8, pyflakes, or pylint set
"
" let g:syntastic_python_checker = 'pyflakes'
"
" in your .vimrc. Default is flake8.
+"============================================================================
if exists("loaded_python_syntax_checker")
finish
endif
let loaded_python_syntax_checker = 1
-"bail if the user doesnt have his favorite checker or flake8 or pyflakes installed
-if !exists('g:syntastic_python_checker') || !executable(g:syntastic_python_checker)
- if executable("flake8")
- let g:syntastic_python_checker = 'flake8'
- elseif executable("pyflakes")
- let g:syntastic_python_checker = 'pyflakes'
- elseif executable("pylint")
- let g:syntastic_python_checker = 'pylint'
- else
- finish
- endif
-endif
if !exists('g:syntastic_python_checker_args')
let g:syntastic_python_checker_args = ''
endif
-function! SyntaxCheckers_python_Term(i)
- if a:i['type'] ==# 'E'
- let a:i['text'] = "Syntax error"
- endif
- if match(a:i['text'], 'is assigned to but never used') > -1
- \ || match(a:i['text'], 'imported but unused') > -1
- \ || match(a:i['text'], 'undefined name') > -1
- \ || match(a:i['text'], 'redefinition of') > -1
- \ || match(a:i['text'], 'referenced before assignment') > -1
- \ || match(a:i['text'], 'duplicate argument') > -1
- \ || match(a:i['text'], 'after other statements') > -1
- \ || match(a:i['text'], 'shadowed by loop variable') > -1
-
- let term = split(a:i['text'], "'", 1)[1]
- return '\V\<'.term.'\>'
- endif
- return ''
-endfunction
-
-if g:syntastic_python_checker == 'pylint'
- function! SyntaxCheckers_python_GetLocList()
- let makeprg = 'pylint -f parseable -r n -i y ' .
- \ shellescape(expand('%')) .
- \ ' \| sed ''s_: \[[RC]_: \[W_''' .
- \ ' \| sed ''s_: \[[F]_:\ \[E_'''
- let errorformat = '%f:%l: [%t%n] %m,%-GNo config%m'
- let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
-
- return errors
- endfunction
-else
- function! SyntaxCheckers_python_GetLocList()
- let makeprg = g:syntastic_python_checker.' '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
- let errorformat =
- \ '%E%f:%l: could not compile,%-Z%p^,%W%f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
-
- let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
-
- call SyntasticHighlightErrors(errors, function('SyntaxCheckers_python_Term'))
-
- return errors
- endfunction
-endif
+let s:supported_checkers = ["flake8", "pyflakes", "pylint"]
+call SyntasticLoadChecker(s:supported_checkers, 'python')
View
31 bundle/syntastic/syntax_checkers/python/flake8.vim
@@ -0,0 +1,31 @@
+"============================================================================
+"File: flake8.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Authors: Sylvain Soliman <Sylvain dot Soliman+git at gmail dot com>
+" kstep <me@kstep.me>
+"
+"============================================================================
+function! SyntaxCheckers_python_GetHighlightRegex(i)
+ if a:i['type'] ==# 'E'
+ let a:i['text'] = "Syntax error"
+ endif
+ if match(a:i['text'], 'is assigned to but never used') > -1
+ \ || match(a:i['text'], 'imported but unused') > -1
+ \ || match(a:i['text'], 'undefined name') > -1
+ \ || match(a:i['text'], 'redefinition of') > -1
+ \ || match(a:i['text'], 'referenced before assignment') > -1
+ \ || match(a:i['text'], 'duplicate argument') > -1
+ \ || match(a:i['text'], 'after other statements') > -1
+ \ || match(a:i['text'], 'shadowed by loop variable') > -1
+
+ let term = split(a:i['text'], "'", 1)[1]
+ return '\V\<'.term.'\>'
+ endif
+ return ''
+endfunction
+
+function! SyntaxCheckers_python_GetLocList()
+ let makeprg = 'flake8 '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
+ let errorformat = '%E%f:%l: could not compile,%-Z%p^,%E%f:%l:%c: %m,%E%f:%l: %m,%-G%.%#'
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+endfunction
View
34 bundle/syntastic/syntax_checkers/python/pyflakes.vim
@@ -0,0 +1,34 @@
+"============================================================================
+"File: pyflakes.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Authors: Martin Grenfell <martin.grenfell@gmail.com>
+" kstep <me@kstep.me>
+" Parantapa Bhattacharya <parantapa@gmail.com>
+"
+"============================================================================
+function! SyntaxCheckers_python_GetHighlightRegex(i)
+ if match(a:i['text'], 'is assigned to but never used') > -1
+ \ || match(a:i['text'], 'imported but unused') > -1
+ \ || match(a:i['text'], 'undefined name') > -1
+ \ || match(a:i['text'], 'redefinition of') > -1
+ \ || match(a:i['text'], 'referenced before assignment') > -1
+ \ || match(a:i['text'], 'duplicate argument') > -1
+ \ || match(a:i['text'], 'after other statements') > -1
+ \ || match(a:i['text'], 'shadowed by loop variable') > -1
+
+ let term = split(a:i['text'], "'", 1)[1]
+ return '\V\<'.term.'\>'
+ endif
+ return ''
+endfunction
+
+function! SyntaxCheckers_python_GetLocList()
+ let makeprg = 'pyflakes '.g:syntastic_python_checker_args.' '.shellescape(expand('%'))
+ let errorformat = '%E%f:%l: could not compile,%-Z%p^,%E%f:%l:%c: %m,%E%f:%l: %m,%-G%.%#'
+
+ let errors = SyntasticMake({ 'makeprg': makeprg,
+ \ 'errorformat': errorformat,
+ \ 'defaults': {'text': "Syntax error"} })
+
+ return errors
+endfunction
View
14 bundle/syntastic/syntax_checkers/python/pylint.vim
@@ -0,0 +1,14 @@
+"============================================================================
+"File: pylint.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Author: Parantapa Bhattacharya <parantapa at gmail dot com>
+"
+"============================================================================
+function! SyntaxCheckers_python_GetLocList()
+ let makeprg = 'pylint '.g:syntastic_python_checker_args.' -f parseable -r n -i y ' .
+ \ shellescape(expand('%')) .
+ \ ' 2>&1 \| sed ''s_: \[[RC]_: \[W_''' .
+ \ ' \| sed ''s_: \[[F]_:\ \[E_'''
+ let errorformat = '%f:%l: [%t%n%.%#] %m,%f:%l: [%t%.%#] %m,%Z,%-GNo config%m'
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+endfunction
View
2  bundle/syntastic/syntax_checkers/rst.vim
@@ -24,7 +24,7 @@ if !executable("rst2pseudoxml.py")
endif
function! SyntaxCheckers_rst_GetLocList()
- let makeprg = 'rst2pseudoxml.py --report=1 --exit-status=1 ' .
+ let makeprg = 'rst2pseudoxml.py --report=2 --exit-status=1 ' .
\ shellescape(expand('%')) . ' /dev/null'
let errorformat = '%f:%l:\ (%tNFO/1)\ %m,
View
18 bundle/syntastic/syntax_checkers/ruby.vim
@@ -8,6 +8,10 @@
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
+"Supports MRI and JRuby but loads the MRI syntax checker by default.
+"
+"Use the g:syntastic_ruby_checker option to specify which checker to load -
+"set it to "jruby" to load the jruby checker.
"============================================================================
if exists("loaded_ruby_syntax_checker")
finish
@@ -19,14 +23,8 @@ if !executable("ruby")
finish
endif
-function! SyntaxCheckers_ruby_GetLocList()
- " we cannot set RUBYOPT on windows like that
- if has('win32') || has('win64')
- let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
- else
- let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
- endif
- let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
+if !exists("g:syntastic_ruby_checker")
+ let g:syntastic_ruby_checker = "mri"
+endif
+exec "runtime! syntax_checkers/ruby/" . g:syntastic_ruby_checker . ".vim"
- return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
-endfunction
View
16 bundle/syntastic/syntax_checkers/ruby/jruby.vim
@@ -0,0 +1,16 @@
+"============================================================================
+"File: jruby.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Maintainer: Leonid Shevtsov <leonid at shevtsov dot 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.
+"
+"============================================================================
+function! SyntaxCheckers_ruby_GetLocList()
+ "let makeprg = ''
+ "let errorformat = ''
+ "return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+endfunction
View
22 bundle/syntastic/syntax_checkers/ruby/mri.vim
@@ -0,0 +1,22 @@
+"============================================================================
+"File: mri.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Maintainer: Martin Grenfell <martin.grenfell 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.
+"
+"============================================================================
+function! SyntaxCheckers_ruby_GetLocList()
+ " we cannot set RUBYOPT on windows like that
+ if has('win32') || has('win64')
+ let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%'))
+ else
+ let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%'))
+ endif
+ let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
+
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+endfunction
View
33 bundle/syntastic/syntax_checkers/scala.vim
@@ -0,0 +1,33 @@
+"============================================================================
+"File: scala.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Maintainer: Rickey Visinski <rickeyvisinski 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("loaded_scala_syntax_checker")
+ finish
+endif
+let loaded_scala_syntax_checker = 1
+
+"bail if the user doesnt have the scala binary installed
+if !executable("scala")
+ finish
+endif
+
+if !exists("g:syntastic_scala_options")
+ let g:syntastic_scala_options = " "
+endif
+
+function! SyntaxCheckers_scala_GetLocList()
+ let makeprg = 'scala '. g:syntastic_scala_options .' '. shellescape(expand('%')) . ' /dev/null'
+
+ let errorformat = '%f\:%l: %trror: %m'
+
+ return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+endfunction
+
View
24 bundle/syntastic/syntax_checkers/vala.vim
@@ -6,6 +6,9 @@
" "// modules: " and containing space delimited list of vala
" modules, used by the file, so this script can build correct
" --pkg arguments.
+" Alternatively you can set g:syntastic_vala_modules array
+" in your .vimrc or .lvimrc with localvimrc plugin
+" (http://www.vim.org/scripts/script.php?script_id=441).
" Valac compiler is not the fastest thing in the world, so you
" may want to disable this plugin with
" let g:syntastic_vala_check_disabled = 1 command in your .vimrc or
@@ -32,16 +35,25 @@ if exists('g:syntastic_vala_check_disabled') && g:syntastic_vala_check_disabled
finish
endif
-function! SyntaxCheckers_vala_Term(pos)
+function! SyntaxCheckers_vala_GetHighlightRegex(pos)
let strlength = strlen(matchstr(a:pos['text'], '\^\+$'))
return '\%>'.(a:pos.col-1).'c.*\%<'.(a:pos.col+strlength+1).'c'
endfunction
function! s:GetValaModules()
+ if exists('g:syntastic_vala_modules')
+ if type(g:syntastic_vala_modules) == type('')
+ return split(g:syntastic_vala_modules, '\s\+')
+ elseif type(g:syntastic_vala_modules) == type([])
+ return g:syntastic_vala_modules
+ else
+ echoerr 'g:syntastic_vala_modules must be either list or string: fallback to in file modules string'
+ endif
+ endif
+
let modules_line = search('^// modules: ', 'n')
let modules_str = getline(modules_line)
- let modules = split(strpart(modules_str, 12), '\s\+')
- return modules
+ return split(strpart(modules_str, 12), '\s\+')
endfunction
function! SyntaxCheckers_vala_GetLocList()
@@ -49,8 +61,8 @@ function! SyntaxCheckers_vala_GetLocList()
let makeprg = 'valac -C ' . vala_pkg_args . ' ' .shellescape(expand('%'))
let errorformat = '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,%C%m,%Z%m'
- let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
- call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_vala_Term"), 1)
- return loclist
+ return SyntasticMake({ 'makeprg': makeprg,
+ \ 'errorformat': errorformat,
+ \ 'defaults': {'force_highlight_callback': 1} })
endfunction
View
31 bundle/syntastic/syntax_checkers/z80.vim
@@ -0,0 +1,31 @@
+"============================================================================
+"File: z80.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Maintainer: Romain Giot <giot.romain 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("loaded_z80_syntax_checker")
+ finish
+endif
+let loaded_z80_syntax_checker = 1
+
+"bail if the user doesnt have z80_syntax_checker.py installed
+"To obtain this application there are two solutions:
+" - Install this python package: https://github.com/rgiot/pycpcdemotools
+" - Copy/paste this script in your search path: https://raw.github.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py
+if !executable("z80_syntax_checker.py")
+ finish
+endif
+
+function! SyntaxCheckers_z80_GetLocList()
+ let makeprg = 'z80_syntax_checker.py '.shellescape(expand('%'))
+ let errorformat = '%f:%l %m'
+ let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
+ return loclist
+endfunction
+
Please sign in to comment.
Something went wrong with that request. Please try again.