From 87f10e54d4a3d3b27fe8e915fe46b726298f1e34 Mon Sep 17 00:00:00 2001 From: Richard Brown Date: Sat, 22 Sep 2012 19:51:12 +0100 Subject: [PATCH] Make IsVersionAtLeast global --- plugin/syntastic.vim | 13 +++++++++++++ syntax_checkers/puppet.vim | 17 ++--------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 2cddcee1..cdd14673 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -500,6 +500,19 @@ function! SyntasticCheckable(ft) return exists("*SyntaxCheckers_". a:ft ."_GetLocList") endfunction +"the args must be arrays of the form [major, minor, macro] +function SyntasticIsVersionAtLeast(installed, required) + if a:installed[0] != a:required[0] + return a:installed[0] > a:required[0] + endif + + if a:installed[1] != a:required[1] + return a:installed[1] > a:required[1] + endif + + return a:installed[2] >= a:required[2] +endfunction + "return a string representing the state of buffer according to "g:syntastic_stl_format " diff --git a/syntax_checkers/puppet.vim b/syntax_checkers/puppet.vim index a675a832..0f3298b5 100644 --- a/syntax_checkers/puppet.vim +++ b/syntax_checkers/puppet.vim @@ -50,21 +50,8 @@ function! s:PuppetLintVersion() return s:puppet_lint_version endfunction -"the args must be arrays of the form [major, minor, macro] -function s:IsVersionAtLeast(installed, required) - if a:installed[0] != a:required[0] - return a:installed[0] > a:required[0] - endif - - if a:installed[1] != a:required[1] - return a:installed[1] > a:required[1] - endif - - return a:installed[2] >= a:required[2] -endfunction - if !g:syntastic_puppet_lint_disable - if !s:IsVersionAtLeast(s:PuppetLintVersion(), [0,1,10]) + if !SyntasticIsVersionAtLeast(s:PuppetLintVersion(), [0,1,10]) let g:syntastic_puppet_lint_disable = 1 endif end @@ -81,7 +68,7 @@ endfunction function! s:getPuppetMakeprg() "If puppet is >= version 2.7 then use the new executable - if s:IsVersionAtLeast(s:PuppetVersion(), [2,7,0]) + if SyntasticIsVersionAtLeast(s:PuppetVersion(), [2,7,0]) let makeprg = 'puppet parser validate ' . \ shellescape(expand('%')) . \ ' --color=false'