summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/chef/foodcritic.vim15
1 files changed, 14 insertions, 1 deletions
diff --git a/ale_linters/chef/foodcritic.vim b/ale_linters/chef/foodcritic.vim
index 0a6807b2..a3a9af2e 100644
--- a/ale_linters/chef/foodcritic.vim
+++ b/ale_linters/chef/foodcritic.vim
@@ -1,6 +1,11 @@
" Author: Edward Larkey <edwlarkey@mac.com>
+" Author: Jose Junior <jose.junior@gmail.com>
" Description: This file adds the foodcritic linter for Chef files.
+" Support options!
+let g:ale_chef_foodcritic_options = get(g:, 'ale_chef_foodcritic_options', '')
+let g:ale_chef_foodcritic_executable = get(g:, 'ale_chef_foodcritic_executable', 'foodcritic')
+
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
" Matches patterns line the following:
"
@@ -29,10 +34,18 @@ function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
return l:output
endfunction
+function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
+ return printf('%s %s %%t',
+ \ g:ale_chef_foodcritic_executable,
+ \ escape(g:ale_chef_foodcritic_options, '~')
+ \)
+endfunction
+
+
call ale#linter#Define('chef', {
\ 'name': 'foodcritic',
\ 'executable': 'foodcritic',
-\ 'command': 'foodcritic %t',
+\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
\})