Use and adapt to more recent checkbashisms.pl. Some refactoring.
This commit is contained in:
parent
cf1a639795
commit
259f7717fb
@ -1,13 +1,9 @@
|
|||||||
"============================================================================
|
"============================================================================
|
||||||
"File: checkbashisms.vim
|
"File: checkbashisms.vim
|
||||||
"Description: Syntax/style checking plugin for syntastic.vim
|
"Description: Shell script syntax/style checking plugin for syntastic.vim
|
||||||
"Maintainer: András Szilárd <andras dot szilard at gmail dot com>
|
"Notes: checkbashisms.pl can be downloaded from
|
||||||
"License: This program is free software. It comes without any warranty,
|
" http://debian.inode.at/debian/pool/main/d/devscripts/
|
||||||
" to the extent permitted by applicable law. You can redistribute
|
" as part of the devscripts package.
|
||||||
" 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_sh_checkbashisms_checker")
|
if exists("g:loaded_syntastic_sh_checkbashisms_checker")
|
||||||
@ -16,35 +12,21 @@ endif
|
|||||||
let g:loaded_syntastic_sh_checkbashisms_checker=1
|
let g:loaded_syntastic_sh_checkbashisms_checker=1
|
||||||
|
|
||||||
|
|
||||||
function! s:IsShShell()
|
|
||||||
let shebang = getbufline(bufnr('%'), 1)[0]
|
|
||||||
if len(shebang) > 0
|
|
||||||
if match(shebang, '\<sh\>') > 0
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
|
||||||
function! SyntaxCheckers_sh_checkbashisms_IsAvailable()
|
function! SyntaxCheckers_sh_checkbashisms_IsAvailable()
|
||||||
return executable('checkbashisms')
|
return executable('checkbashisms.pl')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! SyntaxCheckers_sh_checkbashisms_GetLocList()
|
function! SyntaxCheckers_sh_checkbashisms_GetLocList()
|
||||||
if !s:IsShShell()
|
let l:makeprg = syntastic#makeprg#build({'exe': 'checkbashisms.pl', 'args': '-fpx'})
|
||||||
return []
|
|
||||||
endif
|
|
||||||
|
|
||||||
let makeprg = syntastic#makeprg#build({'exe': 'checkbashisms'})
|
let l:errorformat =
|
||||||
|
\ '%Eerror: %f: %m,' .
|
||||||
|
\ '%Ecannot open script %f for reading: %m,' .
|
||||||
|
\ '%Wscript %f %m,%C%.# lines,' .
|
||||||
|
\ '%Wpossible bashism in %f line %l (%m):,%C%.%#,%Z.%#'
|
||||||
|
|
||||||
let errorformat = '%Eerror: %f: %m,'
|
return SyntasticMake({'makeprg': l:makeprg, 'errorformat': l:errorformat})
|
||||||
let errorformat = errorformat . '%Ecannot open script %f for reading: %m,'
|
|
||||||
let errorformat = errorformat . '%Wscript %f %m,%C%.# lines,'
|
|
||||||
let errorformat = errorformat . '%Wpossible bashism in %f line %l (%m):,%C%.%#,%Z.%#'
|
|
||||||
|
|
||||||
return SyntasticMake({'makeprg': makeprg, 'errorformat': errorformat})
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user