Simplify the code for most linters and tests with closures

This commit is contained in:
w0rp
2018-08-02 23:44:12 +01:00
parent 9ef266d050
commit 217284360d
102 changed files with 631 additions and 1232 deletions
+3 -8
View File
@@ -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