From bf1ac8e822835ac2b0e1173e1e014c773b8e51a6 Mon Sep 17 00:00:00 2001 From: Matteo Centenaro Date: Wed, 10 Oct 2018 18:19:47 +0200 Subject: FIX: use mix from the project root directory (#1954) * FIX: use mix from the project root directory * Move find root project function to autoloaded handlers * add tests for #ale#handlers#elixr#FindMixProjectRoot --- ale_linters/elixir/credo.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ale_linters/elixir/credo.vim') 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', \}) -- cgit v1.2.3