From fd38284b28c5352f6f6f1466969f79d662e526d7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 20:56:39 +0300 Subject: [PATCH] Cleanup. --- syntax_checkers/coffee/coffee.vim | 2 +- syntax_checkers/cuda/nvcc.vim | 11 ++++++--- syntax_checkers/go/go.vim | 34 ++++++++++++++++++++------- syntax_checkers/nasm/nasm.vim | 7 +----- syntax_checkers/ocaml/camlp4o.vim | 14 +++++------ syntax_checkers/puppet/puppetlint.vim | 4 ++-- syntax_checkers/slim/slimrb.vim | 2 +- syntax_checkers/text/atdtool.vim | 2 +- 8 files changed, 47 insertions(+), 29 deletions(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index c49d7c26..846180b9 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -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() diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index d570152c..d5649d30 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -30,11 +30,13 @@ endfunction function! SyntaxCheckers_cuda_nvcc_GetLocList() if exists('g:syntastic_cuda_arch') - let arch_flag = '-arch='.g:syntastic_cuda_arch + let arch_flag = '-arch=' . g:syntastic_cuda_arch 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 diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 2534bcb5..8d023f30 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -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) diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 3bab07dc..dcbdd418 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -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' }) diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index 69d7494c..805aa073 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -112,16 +112,16 @@ function s:GetOcamlcMakeprg() if g:syntastic_ocaml_use_janestreet_core let build_cmd = "ocamlc -I " let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir) - let build_cmd .= " -c ".expand('%') + let build_cmd .= " -c " . expand('%') return build_cmd else - return "ocamlc -c ". expand('%') + return "ocamlc -c " . expand('%') endif endfunction function s:GetOcamlBuildMakeprg() - return "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ". - \ shellescape(expand('%:r')).".cmi" + return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " . + \ shellescape(expand('%:r')) . ".cmi" endfunction function s:GetOtherMakeprg() @@ -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 diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 32ccd901..54f5b83b 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -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 diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 106a1b51..2644decf 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -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 diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 5cc99b87..bfccb7e6 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -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' })