puppet: extract the puppet errorformat generation code into a function
This commit is contained in:
parent
7b51216924
commit
d210940339
@ -78,25 +78,27 @@ function! s:getPuppetMakeprg()
|
|||||||
return makeprg
|
return makeprg
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:getPuppetEfm()
|
||||||
|
"some versions of puppet (e.g. 2.7.10) output the message below if there
|
||||||
|
"are any syntax errors
|
||||||
|
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
|
||||||
|
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
|
||||||
|
|
||||||
|
"Puppet 3.0.0 changes this from "err:" to "Error:"
|
||||||
|
"reset errorformat in that case
|
||||||
|
if SyntasticIsVersionAtLeast(s:PuppetVersion(), [3,0,0])
|
||||||
|
let errorformat = '%-GError: Try ''puppet help parser validate'' for usage,'
|
||||||
|
let errorformat .= 'Error: Could not parse for environment %*[a-z]: %m at %f:%l'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return errorformat
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_puppet_GetLocList()
|
function! SyntaxCheckers_puppet_GetLocList()
|
||||||
let errors = []
|
let errors = []
|
||||||
|
|
||||||
if !g:syntastic_puppet_validate_disable
|
if !g:syntastic_puppet_validate_disable
|
||||||
let makeprg = s:getPuppetMakeprg()
|
let errors = errors + SyntasticMake({ 'makeprg': s:getPuppetMakeprg(), 'errorformat': s:getPuppetEfm() })
|
||||||
|
|
||||||
"some versions of puppet (e.g. 2.7.10) output the message below if there
|
|
||||||
"are any syntax errors
|
|
||||||
let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,'
|
|
||||||
let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l'
|
|
||||||
|
|
||||||
"Puppet 3.0.0 changes this from "err:" to "Error:"
|
|
||||||
"reset errorformat in that case
|
|
||||||
if SyntasticIsVersionAtLeast(s:PuppetVersion(), [3,0,0])
|
|
||||||
let errorformat = '%-GError: Try ''puppet help parser validate'' for usage,'
|
|
||||||
let errorformat .= 'Error: Could not parse for environment %*[a-z]: %m at %f:%l'
|
|
||||||
endif
|
|
||||||
|
|
||||||
let errors = errors + SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !g:syntastic_puppet_lint_disable
|
if !g:syntastic_puppet_lint_disable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user