puppet: extract the puppet errorformat generation code into a function

This commit is contained in:
Martin Grenfell 2012-10-12 10:54:28 +01:00
parent 7b51216924
commit d210940339

View File

@ -78,12 +78,7 @@ function! s:getPuppetMakeprg()
return makeprg return makeprg
endfunction endfunction
function! SyntaxCheckers_puppet_GetLocList() function! s:getPuppetEfm()
let errors = []
if !g:syntastic_puppet_validate_disable
let makeprg = s:getPuppetMakeprg()
"some versions of puppet (e.g. 2.7.10) output the message below if there "some versions of puppet (e.g. 2.7.10) output the message below if there
"are any syntax errors "are any syntax errors
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,' let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
@ -96,7 +91,14 @@ function! SyntaxCheckers_puppet_GetLocList()
let errorformat .= 'Error: Could not parse for environment %*[a-z]: %m at %f:%l' let errorformat .= 'Error: Could not parse for environment %*[a-z]: %m at %f:%l'
endif endif
let errors = errors + SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) return errorformat
endfunction
function! SyntaxCheckers_puppet_GetLocList()
let errors = []
if !g:syntastic_puppet_validate_disable
let errors = errors + SyntasticMake({ 'makeprg': s:getPuppetMakeprg(), 'errorformat': s:getPuppetEfm() })
endif endif
if !g:syntastic_puppet_lint_disable if !g:syntastic_puppet_lint_disable