summaryrefslogtreecommitdiff
path: root/ale_linters/erlang
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/erlang')
-rw-r--r--ale_linters/erlang/syntaxerl.vim26
1 files changed, 17 insertions, 9 deletions
diff --git a/ale_linters/erlang/syntaxerl.vim b/ale_linters/erlang/syntaxerl.vim
index e7d006b4..46ecdcb7 100644
--- a/ale_linters/erlang/syntaxerl.vim
+++ b/ale_linters/erlang/syntaxerl.vim
@@ -2,7 +2,6 @@
" Description: SyntaxErl linter for Erlang files
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
-call ale#Set('erlang_syntaxerl_use_basename', 0)
function! ale_linters#erlang#syntaxerl#GetExecutable(buffer) abort
@@ -10,14 +9,15 @@ function! ale_linters#erlang#syntaxerl#GetExecutable(buffer) abort
endfunction
-function! ale_linters#erlang#syntaxerl#GetCommand(buffer) abort
- let l:base_options = ale#Var(a:buffer, 'erlang_syntaxerl_use_basename')
- \ ? ' -b %s'
- \ : ''
+function! ale_linters#erlang#syntaxerl#FeatureCheck(buffer) abort
+ return s:GetEscapedExecutable(a:buffer) . ' -h'
+endfunction
+
+
+function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort
+ let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
- return ale_linters#erlang#syntaxerl#GetExecutable(a:buffer)
- \ . l:base_options
- \ . ' %t'
+ return s:GetEscapedExecutable(a:buffer) . (l:use_b_option ? ' -b %s %t' : ' %t')
endfunction
@@ -37,9 +37,17 @@ function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
endfunction
+function! s:GetEscapedExecutable(buffer) abort
+ return ale#Escape(ale_linters#erlang#syntaxerl#GetExecutable(a:buffer))
+endfunction
+
+
call ale#linter#Define('erlang', {
\ 'name': 'syntaxerl',
\ 'executable_callback': 'ale_linters#erlang#syntaxerl#GetExecutable',
-\ 'command_callback': 'ale_linters#erlang#syntaxerl#GetCommand',
+\ 'command_chain': [
+\ {'callback': 'ale_linters#erlang#syntaxerl#FeatureCheck'},
+\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'},
+\ ],
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
\})