summaryrefslogtreecommitdiff
path: root/ale_linters/terraform
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
committerw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
commit217284360d35711b751859ed27a7a3c3da300e85 (patch)
tree4b26a84b397e3ac15a8b13a572b1f9a50312dbab /ale_linters/terraform
parent9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff)
downloadale-217284360d35711b751859ed27a7a3c3da300e85.zip
Simplify the code for most linters and tests with closures
Diffstat (limited to 'ale_linters/terraform')
-rw-r--r--ale_linters/terraform/tflint.vim11
1 files changed, 3 insertions, 8 deletions
diff --git a/ale_linters/terraform/tflint.vim b/ale_linters/terraform/tflint.vim
index 93966ff3..b8e9c96d 100644
--- a/ale_linters/terraform/tflint.vim
+++ b/ale_linters/terraform/tflint.vim
@@ -30,14 +30,11 @@ function! ale_linters#terraform#tflint#Handle(buffer, lines) abort
return l:output
endfunction
-function! ale_linters#terraform#tflint#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'terraform_tflint_executable')
-endfunction
-
function! ale_linters#terraform#tflint#GetCommand(buffer) abort
- let l:cmd = ale#Escape(ale#Var(a:buffer, 'terraform_tflint_executable'))
+ let l:cmd = '%e'
let l:config_file = ale#path#FindNearestFile(a:buffer, '.tflint.hcl')
+
if !empty(l:config_file)
let l:cmd .= ' --config ' . ale#Escape(l:config_file)
endif
@@ -54,9 +51,7 @@ endfunction
call ale#linter#Define('terraform', {
\ 'name': 'tflint',
-\ 'executable_callback': 'ale_linters#terraform#tflint#GetExecutable',
+\ 'executable_callback': ale#VarFunc('terraform_tflint_executable'),
\ 'command_callback': 'ale_linters#terraform#tflint#GetCommand',
\ 'callback': 'ale_linters#terraform#tflint#Handle',
\})
-
-" vim:sw=4