diff options
Diffstat (limited to 'ale_linters/elixir')
-rw-r--r-- | ale_linters/elixir/credo.vim | 9 | ||||
-rw-r--r-- | ale_linters/elixir/dialyxir.vim | 9 | ||||
-rw-r--r-- | ale_linters/elixir/dogma.vim | 9 | ||||
-rw-r--r-- | ale_linters/elixir/mix.vim | 16 |
4 files changed, 27 insertions, 16 deletions
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim index af2ff48a..6e949677 100644 --- a/ale_linters/elixir/credo.vim +++ b/ale_linters/elixir/credo.vim @@ -29,9 +29,16 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort return l:output endfunction +function! ale_linters#elixir#credo#GetCommand(buffer) abort + let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) + + return ale#path#CdString(l:project_root) + \ . ' mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s' +endfunction + call ale#linter#Define('elixir', { \ 'name': 'credo', \ 'executable': 'mix', -\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s', +\ 'command_callback': 'ale_linters#elixir#credo#GetCommand', \ 'callback': 'ale_linters#elixir#credo#Handle', \}) diff --git a/ale_linters/elixir/dialyxir.vim b/ale_linters/elixir/dialyxir.vim index bba0ae14..d28d3c70 100644 --- a/ale_linters/elixir/dialyxir.vim +++ b/ale_linters/elixir/dialyxir.vim @@ -25,10 +25,17 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort return l:output endfunction +function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort + let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) + + return ale#path#CdString(l:project_root) + \ . ' mix help dialyzer && mix dialyzer' +endfunction + call ale#linter#Define('elixir', { \ 'name': 'dialyxir', \ 'executable': 'mix', -\ 'command': 'mix help dialyzer && mix dialyzer', +\ 'command_callback': 'ale_linters#elixir#dialyxir#GetCommand', \ 'callback': 'ale_linters#elixir#dialyxir#Handle', \}) diff --git a/ale_linters/elixir/dogma.vim b/ale_linters/elixir/dogma.vim index 71cf4f4c..dcfb6f28 100644 --- a/ale_linters/elixir/dogma.vim +++ b/ale_linters/elixir/dogma.vim @@ -29,10 +29,17 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort return l:output endfunction +function! ale_linters#elixir#dogma#GetCommand(buffer) abort + let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) + + return ale#path#CdString(l:project_root) + \ . ' mix help dogma && mix dogma %s --format=flycheck' +endfunction + call ale#linter#Define('elixir', { \ 'name': 'dogma', \ 'executable': 'mix', -\ 'command': 'mix help dogma && mix dogma %s --format=flycheck', +\ 'command_callback': 'ale_linters#elixir#dogma#GetCommand', \ 'lint_file': 1, \ 'callback': 'ale_linters#elixir#dogma#Handle', \}) diff --git a/ale_linters/elixir/mix.vim b/ale_linters/elixir/mix.vim index 4552ace5..dc3c1818 100644 --- a/ale_linters/elixir/mix.vim +++ b/ale_linters/elixir/mix.vim @@ -29,18 +29,8 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort - let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs') - - if !empty(l:mix_file) - return fnamemodify(l:mix_file, ':p:h') - endif - - return '.' -endfunction - function! ale_linters#elixir#mix#GetCommand(buffer) abort - let l:project_root = ale_linters#elixir#mix#FindProjectRoot(a:buffer) + let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) let l:temp_dir = ale#engine#CreateDirectory(a:buffer) @@ -49,8 +39,8 @@ function! ale_linters#elixir#mix#GetCommand(buffer) abort \ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) return ale#path#CdString(l:project_root) - \ . l:mix_build_path - \ . ' mix compile %s' + \ . l:mix_build_path + \ . ' mix compile %s' endfunction call ale#linter#Define('elixir', { |