This commit is contained in:
LCD 47 2013-06-07 20:56:39 +03:00
parent 6e90447a31
commit fd38284b28
8 changed files with 47 additions and 29 deletions

View File

@ -19,7 +19,7 @@ let g:loaded_syntastic_coffee_coffee_checker=1
function! SyntaxCheckers_coffee_coffee_IsAvailable()
return executable("coffee") &&
\ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>/dev/null'), [1,6,2])
\ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2])
endfunction
function! SyntaxCheckers_coffee_coffee_GetLocList()

View File

@ -34,7 +34,9 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList()
else
let arch_flag = ''
endif
let makeprg = 'nvcc '.arch_flag.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
let makeprg =
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
\ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice()
let errorformat =
\ '%*[^"]"%f"%*\D%l: %m,'.
\ '"%f"%*\D%l: %m,'.
@ -53,7 +55,10 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList()
if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
if exists('g:syntastic_cuda_check_header')
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc '.arch_flag.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
let makeprg =
\ 'echo > .syntastic_dummy.cu ; ' .
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
\ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice()
else
return []
endif

View File

@ -25,10 +25,21 @@ function! SyntaxCheckers_go_go_GetLocList()
" Check with gofmt first, since `go build` and `go test` might not report
" syntax errors in the current file if another file with syntax error is
" compiled first.
let makeprg = 'gofmt -l % 1>/dev/null'
let errorformat = '%f:%l:%c: %m,%-G%.%#'
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'e'} })
let makeprg = syntastic#makeprg#build({
\ 'exe': 'gofmt',
\ 'args': '-l',
\ 'tail': '1>' . syntastic#util#DevNull(),
\ 'filetype': 'go',
\ 'subchecker': 'go' })
let errorformat =
\ '%f:%l:%c: %m,' .
\ '%-G%.%#'
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
if !empty(errors)
return errors
endif
@ -36,22 +47,29 @@ function! SyntaxCheckers_go_go_GetLocList()
" Test files, i.e. files with a name ending in `_test.go`, are not
" compiled by `go build`, therefore `go test` must be called for those.
if match(expand('%'), '_test.go$') == -1
let makeprg = 'go build -o /dev/null'
let makeprg = 'go build ' . syntastic#c#GetNullDevice()
else
let makeprg = 'go test -c -o /dev/null'
let makeprg = 'go test -c ' . syntastic#c#GetNullDevice()
endif
let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#'
let errorformat =
\ '%f:%l:%c:%m,' .
\ '%f:%l%m,' .
\ '%-G#%.%#'
" The go compiler needs to either be run with an import path as an
" argument or directly from the package directory. Since figuring out
" the poper import path is fickle, just pushd/popd to the package.
let popd = getcwd()
let pushd = expand('%:p:h')
"
" pushd
exec 'lcd ' . fnameescape(pushd)
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
" popd
exec 'lcd ' . fnameescape(popd)

View File

@ -19,15 +19,10 @@ function! SyntaxCheckers_nasm_nasm_IsAvailable()
endfunction
function! SyntaxCheckers_nasm_nasm_GetLocList()
if has("win32")
let outfile="NUL"
else
let outfile="/dev/null"
endif
let wd = shellescape(expand("%:p:h") . "/")
let makeprg = syntastic#makeprg#build({
\ 'exe': 'nasm',
\ 'args': '-X gnu -f elf -I ' . wd . ' -o ' . outfile,
\ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#GetNullDevice()
\ 'filetype': 'nasm',
\ 'subchecker': 'nasm' })

View File

@ -134,11 +134,11 @@ function s:GetOtherMakeprg()
if match(extension, 'mly') >= 0 && executable("menhir")
" ocamlyacc output can't be redirected, so use menhir
let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null"
let makeprg = "menhir --only-preprocess " . shellescape(expand('%')) . " >" . syntastic#util#DevNull()
elseif match(extension,'mll') >= 0 && executable("ocamllex")
let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%'))
let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%'))
else
let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%'))
let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%'))
endif
return makeprg

View File

@ -33,14 +33,14 @@ endif
function! s:PuppetVersion()
if !exists("s:puppet_version")
let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>/dev/null")
let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>" . syntastic#util#DevNull())
endif
return s:puppet_version
endfunction
function! s:PuppetLintVersion()
if !exists("s:puppet_lint_version")
let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>/dev/null")
let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>" . syntastic#util#DevNull())
endif
return s:puppet_lint_version
endfunction

View File

@ -21,7 +21,7 @@ endfunction
function! s:SlimrbVersion()
if !exists('s:slimrb_version')
let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>/dev/null')
let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>' . syntastic#util#DevNull())
end
return s:slimrb_version
endfunction

View File

@ -31,7 +31,7 @@ endfunction
function! SyntaxCheckers_text_atdtool_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'atdtool',
\ 'tail': '2>/dev/null',
\ 'tail': '2>' . syntastic#util#DevNull(),
\ 'filetype': 'text',
\ 'subchecker': 'atdtool' })