]> git.madduck.net Git - etc/vim.git/blob - ale_linters/elixir/dialyxir.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / ale_linters / elixir / dialyxir.vim
1 " Author: Fran C. - https://github.com/franciscoj
2 " Description: Add dialyzer support for elixir through dialyxir
3 " https://github.com/jeremyjh/dialyxir
4
5 function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
6     " Matches patterns line the following:
7     "
8     " lib/filename.ex:19: Function fname/1 has no local return
9     let l:pattern = '\v(.+):(\d+): (.+)$'
10     let l:output = []
11     let l:type = 'W'
12
13     for l:match in ale#util#GetMatches(a:lines, l:pattern)
14         if bufname(a:buffer) == l:match[1]
15             call add(l:output, {
16             \   'bufnr': a:buffer,
17             \   'lnum': l:match[2] + 0,
18             \   'col': 0,
19             \   'type': l:type,
20             \   'text': l:match[3],
21             \})
22         endif
23     endfor
24
25     return l:output
26 endfunction
27
28 call ale#linter#Define('elixir', {
29 \   'name': 'dialyxir',
30 \   'executable': 'mix',
31 \   'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
32 \   'command': 'mix help dialyzer && mix dialyzer',
33 \   'callback': 'ale_linters#elixir#dialyxir#Handle',
34 \})