From 192f211a0ee63c716d0d5887755d1e139a82ace8 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Mon, 27 Aug 2018 12:59:38 -0500 Subject: Support options for puppet parser validate It can be necessary to pass options to the puppet parser validation. The most glaring example of this is when using Puppet 3, with the `parser = future` option enabled. This update allows adding `--parser=future` to the options passed to Puppet. --- ale_linters/puppet/puppet.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ale_linters/puppet') diff --git a/ale_linters/puppet/puppet.vim b/ale_linters/puppet/puppet.vim index 4ca0dd55..1ed268d1 100644 --- a/ale_linters/puppet/puppet.vim +++ b/ale_linters/puppet/puppet.vim @@ -1,5 +1,8 @@ " Author: Alexander Olofsson +call ale#Set('puppet_puppet_executable', 'puppet') +call ale#Set('puppet_puppet_options', '--color=false') + function! ale_linters#puppet#puppet#Handle(buffer, lines) abort " Matches patterns like the following: " Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12 @@ -20,10 +23,16 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort return l:output endfunction +function! ale_linters#puppet#puppet#GetCommand(buffer) abort + return '%e parser validate ' + \ . ale#Pad(ale#Var(a:buffer, 'puppet_puppet_options')) + \ . ' %t' +endfunction + call ale#linter#Define('puppet', { \ 'name': 'puppet', -\ 'executable': 'puppet', +\ 'executable_callback': ale#VarFunc('puppet_puppet_executable'), \ 'output_stream': 'stderr', -\ 'command': 'puppet parser validate --color=false %t', +\ 'command_callback': 'ale_linters#puppet#puppet#GetCommand', \ 'callback': 'ale_linters#puppet#puppet#Handle', \}) -- cgit v1.2.3 From ed26ddc09cfa6374c460822ae30ab8a34619210a Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Wed, 29 Aug 2018 07:11:51 -0500 Subject: Always use --color=false when validating puppet Colorized output is difficult for ALE to parse. --- ale_linters/puppet/puppet.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ale_linters/puppet') diff --git a/ale_linters/puppet/puppet.vim b/ale_linters/puppet/puppet.vim index 1ed268d1..d44bb517 100644 --- a/ale_linters/puppet/puppet.vim +++ b/ale_linters/puppet/puppet.vim @@ -1,7 +1,7 @@ " Author: Alexander Olofsson call ale#Set('puppet_puppet_executable', 'puppet') -call ale#Set('puppet_puppet_options', '--color=false') +call ale#Set('puppet_puppet_options', '') function! ale_linters#puppet#puppet#Handle(buffer, lines) abort " Matches patterns like the following: @@ -24,7 +24,7 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort endfunction function! ale_linters#puppet#puppet#GetCommand(buffer) abort - return '%e parser validate ' + return '%e parser validate --color=false ' \ . ale#Pad(ale#Var(a:buffer, 'puppet_puppet_options')) \ . ' %t' endfunction -- cgit v1.2.3