diff options
Diffstat (limited to 'ale_linters/elixir/credo.vim')
-rw-r--r-- | ale_linters/elixir/credo.vim | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim index af2ff48a..d778471c 100644 --- a/ale_linters/elixir/credo.vim +++ b/ale_linters/elixir/credo.vim @@ -11,10 +11,18 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort let l:type = l:match[3] let l:text = l:match[4] - if l:type is# 'C' - let l:type = 'E' - elseif l:type is# 'R' + " Refactoring opportunities + if l:type is# 'F' + let l:type = 'W' + " Consistency + elseif l:type is# 'C' let l:type = 'W' + " Software Design + elseif l:type is# 'D' + let l:type = 'I' + " Code Readability + elseif l:type is# 'R' + let l:type = 'I' endif call add(l:output, { @@ -29,9 +37,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', \}) |