From d09bd1ea7eaaed94bdfb06e11f4512bf97a164dc Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 14 Nov 2013 10:25:37 +0200 Subject: [PATCH] Update: shellcheck now has a gcc-style output mode. --- syntax_checkers/sh/shellcheck.vim | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index bb19c842..b697a510 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -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