]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/clojure/joker.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:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / ale_linters / clojure / joker.vim
1 " Author: Nic West <nicwest@mailbox.org>
2 " Description: linter for clojure using joker https://github.com/candid82/joker
3
4 function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
5     " output format
6     " <filename>:<line>:<column>: <issue type>: <message>
7     let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Read error|Parse error|Parse warning|Exception): ?(.+))$'
8     let l:output = []
9
10     for l:match in ale#util#GetMatches(a:lines, l:pattern)
11         let l:type = 'E'
12
13         if l:match[4] is? 'Parse warning'
14             let l:type = 'W'
15         endif
16
17         call add(l:output, {
18         \   'lnum': l:match[1] + 0,
19         \   'col': l:match[2] + 0,
20         \   'text': l:match[3],
21         \   'type': l:type,
22         \})
23     endfor
24
25     return l:output
26 endfunction
27
28 call ale#linter#Define('clojure', {
29 \   'name': 'joker',
30 \   'output_stream': 'stderr',
31 \   'executable': 'joker',
32 \   'command': 'joker --working-dir %s --lint %t',
33 \   'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
34 \})