summaryrefslogtreecommitdiff
path: root/ale_linters/lua
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-15 13:35:54 +0100
committerw0rp <devw0rp@gmail.com>2017-04-15 13:36:16 +0100
commit706dd050f2ec570eb12398d42a18f6c4f2bd56df (patch)
tree2c463aa0d5ef02feab3f2ef87215bd4417b47729 /ale_linters/lua
parent2f009690c3cf442f828830cc1d2fece619f308ff (diff)
downloadale-706dd050f2ec570eb12398d42a18f6c4f2bd56df.zip
Fix #257 in preparation for #427, standardise options with fallbacks, and make it so every value can be computed dynamically
Diffstat (limited to 'ale_linters/lua')
-rw-r--r--ale_linters/lua/luacheck.vim13
1 files changed, 11 insertions, 2 deletions
diff --git a/ale_linters/lua/luacheck.vim b/ale_linters/lua/luacheck.vim
index e208c93b..ab590911 100644
--- a/ale_linters/lua/luacheck.vim
+++ b/ale_linters/lua/luacheck.vim
@@ -4,6 +4,15 @@
let g:ale_lua_luacheck_executable =
\ get(g:, 'ale_lua_luacheck_executable', 'luacheck')
+function! ale_linters#lua#luacheck#GetExecutable(buffer) abort
+ return g:ale_lua_luacheck_executable
+endfunction
+
+function! ale_linters#lua#luacheck#GetCommand(buffer) abort
+ return ale_linters#lua#luacheck#GetExecutable(a:buffer)
+ \ . ' --formatter plain --codes --filename %s -'
+endfunction
+
function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
" Matches patterns line the following:
"
@@ -33,7 +42,7 @@ endfunction
call ale#linter#Define('lua', {
\ 'name': 'luacheck',
-\ 'executable': g:ale_lua_luacheck_executable,
-\ 'command': g:ale_lua_luacheck_executable . ' --formatter plain --codes --filename %s -',
+\ 'executable_callback': 'ale_linters#lua#luacheck#GetExecutable',
+\ 'command_callback': 'ale_linters#lua#luacheck#GetCommand',
\ 'callback': 'ale_linters#lua#luacheck#Handle',
\})