summaryrefslogtreecommitdiff
path: root/ale_linters/elixir
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/elixir')
-rw-r--r--ale_linters/elixir/credo.vim7
-rw-r--r--ale_linters/elixir/dialyxir.vim11
-rw-r--r--ale_linters/elixir/dogma.vim10
-rw-r--r--ale_linters/elixir/mix.vim11
4 files changed, 8 insertions, 31 deletions
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim
index 892d47b9..d6a861f4 100644
--- a/ale_linters/elixir/credo.vim
+++ b/ale_linters/elixir/credo.vim
@@ -56,11 +56,7 @@ function! ale_linters#elixir#credo#GetConfigFile() abort
endfunction
function! ale_linters#elixir#credo#GetCommand(buffer) abort
- let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
- let l:mode = ale_linters#elixir#credo#GetMode()
-
- return ale#path#CdString(l:project_root)
- \ . 'mix help credo && '
+ return 'mix help credo && '
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
\ . ale_linters#elixir#credo#GetConfigFile()
\ . ' --format=flycheck --read-from-stdin %s'
@@ -69,6 +65,7 @@ endfunction
call ale#linter#Define('elixir', {
\ 'name': 'credo',
\ 'executable': 'mix',
+\ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
\ 'command': function('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 c7da7757..9b8a5cda 100644
--- a/ale_linters/elixir/dialyxir.vim
+++ b/ale_linters/elixir/dialyxir.vim
@@ -25,17 +25,10 @@ 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': function('ale_linters#elixir#dialyxir#GetCommand'),
+\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
+\ 'command': 'mix help dialyzer && mix dialyzer',
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
\})
-
diff --git a/ale_linters/elixir/dogma.vim b/ale_linters/elixir/dogma.vim
index 1c721158..28e7f420 100644
--- a/ale_linters/elixir/dogma.vim
+++ b/ale_linters/elixir/dogma.vim
@@ -29,17 +29,11 @@ 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': function('ale_linters#elixir#dogma#GetCommand'),
+\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
+\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
\ 'lint_file': 1,
\ 'callback': 'ale_linters#elixir#dogma#Handle',
\})
diff --git a/ale_linters/elixir/mix.vim b/ale_linters/elixir/mix.vim
index abf5d0aa..948c6d36 100644
--- a/ale_linters/elixir/mix.vim
+++ b/ale_linters/elixir/mix.vim
@@ -30,22 +30,15 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
endfunction
function! ale_linters#elixir#mix#GetCommand(buffer) abort
- let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
-
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
- let l:mix_build_path = has('win32')
- \ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&'
- \ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)
-
- return ale#path#CdString(l:project_root)
- \ . l:mix_build_path
- \ . ' mix compile %s'
+ return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s'
endfunction
call ale#linter#Define('elixir', {
\ 'name': 'mix',
\ 'executable': 'mix',
+\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
\ 'command': function('ale_linters#elixir#mix#GetCommand'),
\ 'callback': 'ale_linters#elixir#mix#Handle',
\ 'lint_file': 1,