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
This commit is contained in:
Matteo Centenaro
2018-10-10 18:19:47 +02:00
committed by w0rp
parent ea49cc759f
commit bf1ac8e822
8 changed files with 50 additions and 16 deletions

View File

@@ -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',
\})