summaryrefslogtreecommitdiff
path: root/ale_linters/lua
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/lua')
-rw-r--r--ale_linters/lua/luac.vim13
-rw-r--r--ale_linters/lua/luacheck.vim16
2 files changed, 6 insertions, 23 deletions
diff --git a/ale_linters/lua/luac.vim b/ale_linters/lua/luac.vim
index 4a6bb403..bca2cd8d 100644
--- a/ale_linters/lua/luac.vim
+++ b/ale_linters/lua/luac.vim
@@ -3,15 +3,6 @@
call ale#Set('lua_luac_executable', 'luac')
-function! ale_linters#lua#luac#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'lua_luac_executable')
-endfunction
-
-function! ale_linters#lua#luac#GetCommand(buffer) abort
- let l:executable = ale_linters#lua#luac#GetExecutable(a:buffer)
- return ale#Escape(l:executable) . ' -p - '
-endfunction
-
function! ale_linters#lua#luac#Handle(buffer, lines) abort
" Matches patterns line the following:
"
@@ -33,8 +24,8 @@ endfunction
call ale#linter#Define('lua', {
\ 'name': 'luac',
-\ 'executable_callback': 'ale_linters#lua#luac#GetExecutable',
-\ 'command_callback': 'ale_linters#lua#luac#GetCommand',
+\ 'executable_callback': ale#VarFunc('lua_luac_executable'),
+\ 'command': '%e -p -',
\ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#lua#luac#Handle',
\})
diff --git a/ale_linters/lua/luacheck.vim b/ale_linters/lua/luacheck.vim
index 725153c6..669103b8 100644
--- a/ale_linters/lua/luacheck.vim
+++ b/ale_linters/lua/luacheck.vim
@@ -1,19 +1,11 @@
" Author: Sol Bekic https://github.com/s-ol
" Description: luacheck linter for lua files
-let g:ale_lua_luacheck_executable =
-\ get(g:, 'ale_lua_luacheck_executable', 'luacheck')
-
-let g:ale_lua_luacheck_options =
-\ get(g:, 'ale_lua_luacheck_options', '')
-
-function! ale_linters#lua#luacheck#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'lua_luacheck_executable')
-endfunction
+call ale#Set('lua_luacheck_executable', 'luacheck')
+call ale#Set('lua_luacheck_options', '')
function! ale_linters#lua#luacheck#GetCommand(buffer) abort
- return ale#Escape(ale_linters#lua#luacheck#GetExecutable(a:buffer))
- \ . ' ' . ale#Var(a:buffer, 'lua_luacheck_options')
+ return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_luacheck_options'))
\ . ' --formatter plain --codes --filename %s -'
endfunction
@@ -46,7 +38,7 @@ endfunction
call ale#linter#Define('lua', {
\ 'name': 'luacheck',
-\ 'executable_callback': 'ale_linters#lua#luacheck#GetExecutable',
+\ 'executable_callback': ale#VarFunc('lua_luacheck_executable'),
\ 'command_callback': 'ale_linters#lua#luacheck#GetCommand',
\ 'callback': 'ale_linters#lua#luacheck#Handle',
\})