2013-10-29 14:24:07 -04:00
|
|
|
"============================================================================
|
|
|
|
"File: shellcheck.vim
|
|
|
|
"Description: Shell script syntax/style checking plugin for syntastic.vim
|
|
|
|
"============================================================================
|
|
|
|
|
|
|
|
if exists("g:loaded_syntastic_sh_shellcheck_checker")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:loaded_syntastic_sh_shellcheck_checker = 1
|
|
|
|
|
2014-01-03 04:29:08 -05:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2013-11-01 10:46:57 -04:00
|
|
|
function! SyntaxCheckers_sh_shellcheck_GetLocList() dict
|
2014-01-28 14:44:44 -05:00
|
|
|
let makeprg = self.makeprgBuild({ 'args_after': '-f gcc' })
|
2013-10-29 14:24:07 -04:00
|
|
|
|
2013-11-14 03:25:37 -05:00
|
|
|
let errorformat =
|
2013-11-15 02:13:33 -05:00
|
|
|
\ '%f:%l:%c: %trror: %m,' .
|
|
|
|
\ '%f:%l:%c: %tarning: %m,' .
|
|
|
|
\ '%f:%l:%c: %tote: %m'
|
2013-10-29 14:24:07 -04:00
|
|
|
|
|
|
|
let loclist = SyntasticMake({
|
|
|
|
\ 'makeprg': makeprg,
|
|
|
|
\ 'errorformat': errorformat,
|
2013-11-13 02:05:06 -05:00
|
|
|
\ 'returns': [0, 1] })
|
2013-10-29 14:24:07 -04:00
|
|
|
|
|
|
|
for e in loclist
|
2013-11-14 03:25:37 -05:00
|
|
|
if e['type'] ==? 'n'
|
2013-10-29 14:24:07 -04:00
|
|
|
let e['type'] = 'w'
|
|
|
|
let e['subtype'] = 'Style'
|
|
|
|
endif
|
|
|
|
endfor
|
|
|
|
|
|
|
|
return loclist
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'sh',
|
2013-11-13 02:05:06 -05:00
|
|
|
\ 'name': 'shellcheck' })
|
2014-01-03 04:29:08 -05:00
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
|
|
|
" vim: set et sts=4 sw=4:
|