From 038789f0ed42cfffbd442a6a399cb2395591821d Mon Sep 17 00:00:00 2001 From: Fran Casas Date: Mon, 22 Jan 2018 13:21:07 +0100 Subject: Add Elixir linter for dialyxir (#1257) * Add Elixir linter for dialyxir * Update doc/ale.txt with dialyxir * Keep elixir tools alphabetically ordered in README * Add a missing entry for dialyxir to the main documentation file. --- ale_linters/elixir/dialyxir.vim | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ale_linters/elixir/dialyxir.vim (limited to 'ale_linters/elixir') diff --git a/ale_linters/elixir/dialyxir.vim b/ale_linters/elixir/dialyxir.vim new file mode 100644 index 00000000..5ef3a047 --- /dev/null +++ b/ale_linters/elixir/dialyxir.vim @@ -0,0 +1,34 @@ +" Author: Fran C. - https://github.com/franciscoj +" Description: Add dialyzer support for elixir through dialyxir +" https://github.com/jeremyjh/dialyxir + +function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " lib/filename.ex:19: Function fname/1 has no local return + let l:pattern = '\v(.+):(\d+): (.+)$' + let l:output = [] + let l:type = 'W' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if bufname(a:buffer) == l:match[1] + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[2] + 0, + \ 'col': 0, + \ 'type': l:type, + \ 'text': l:match[3], + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('elixir', { +\ 'name': 'dialyxir', +\ 'executable': 'mix', +\ 'command': 'mix dialyzer', +\ 'callback': 'ale_linters#elixir#dialyxir#Handle', +\}) + -- cgit v1.2.3