summaryrefslogtreecommitdiff
path: root/ale_linters/clojure
diff options
context:
space:
mode:
authorNic West <nicwest.cb@gmail.com>2017-11-15 21:46:51 +0000
committerNic West <nicwest.cb@gmail.com>2017-11-15 22:23:46 +0000
commiteda20d0585567b22befa0e011324aaa91b9bebca (patch)
tree75b74d084e741a73afe379f10428b12f4ddf5c98 /ale_linters/clojure
parent1d65e5692f7075bad6806d88eb11961ea32d3e7d (diff)
downloadale-eda20d0585567b22befa0e011324aaa91b9bebca.zip
add joker handler for clojure
Adds new linter for clojure using joker https://github.com/candid82/joker fixes #975 ref #544 #1040
Diffstat (limited to 'ale_linters/clojure')
-rw-r--r--ale_linters/clojure/joker.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/ale_linters/clojure/joker.vim b/ale_linters/clojure/joker.vim
new file mode 100644
index 00000000..e78066fe
--- /dev/null
+++ b/ale_linters/clojure/joker.vim
@@ -0,0 +1,32 @@
+" Author: Nic West <nicwest@mailbox.org>
+" Description: linter for clojure using joker https://github.com/candid82/joker
+
+function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
+ " output format
+ " <filename>:<line>:<column>: <issue type>: <message>
+ let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Read error|Parse error|Parse warning|Exception): ?(.+))$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ let l:type = 'E'
+ if l:match[4] is? 'Parse warning'
+ let l:type = 'W'
+ endif
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': l:match[2] + 0,
+ \ 'text': l:match[3],
+ \ 'type': l:type,
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('clojure', {
+\ 'name': 'joker',
+\ 'output_stream': 'stderr',
+\ 'executable': 'joker',
+\ 'command': 'joker --lint %t',
+\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
+\})