Update: shellcheck now has a gcc-style output mode.
This commit is contained in:
parent
bdc4b0f177
commit
d09bd1ea7e
@ -8,29 +8,21 @@ if exists("g:loaded_syntastic_sh_shellcheck_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_sh_shellcheck_checker = 1
|
||||
|
||||
function! SyntaxCheckers_sh_shellcheck_Preprocess(json)
|
||||
" A hat tip to Mark Weber for this trick
|
||||
" http://stackoverflow.com/a/19105763
|
||||
let errors = eval(join(a:json, ''))
|
||||
|
||||
call filter(errors, 'v:val["level"] =~? ''\v^(error|warning|style)$''')
|
||||
return map(errors, 'v:val["level"][0] . ":" . v:val["line"] . ":" . v:val["column"] . ":" . v:val["message"]')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_sh_shellcheck_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args': '-f json' })
|
||||
let makeprg = self.makeprgBuild({ 'args': '-f gcc' })
|
||||
|
||||
let errorformat = '%t:%l:%v:%m'
|
||||
let errorformat =
|
||||
\ '%f:%l:%v: %trror: %m,' .
|
||||
\ '%f:%l:%v: %tarning: %m,' .
|
||||
\ '%f:%l:%v: %tote: %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'SyntaxCheckers_sh_shellcheck_Preprocess',
|
||||
\ 'defaults': {'bufnr': bufnr("")},
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
if e['type'] ==? 's'
|
||||
if e['type'] ==? 'n'
|
||||
let e['type'] = 'w'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user