summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorMasashi Iizuka <liquidz.uo@gmail.com>2019-04-11 04:59:58 +0900
committerw0rp <w0rp@users.noreply.github.com>2019-04-10 20:59:58 +0100
commit481316561445a4048a96a2c6bd41e9b623d8919f (patch)
treed9dd770a6129f21506f940d7e0b10f652d25fd45 /ale_linters
parent16b43a5708f993fc822c50053090a136578e1b33 (diff)
downloadale-481316561445a4048a96a2c6bd41e9b623d8919f.zip
Add a linter for clojure using clj-kondo (#2377)
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/clojure/clj_kondo.vim34
1 files changed, 34 insertions, 0 deletions
diff --git a/ale_linters/clojure/clj_kondo.vim b/ale_linters/clojure/clj_kondo.vim
new file mode 100644
index 00000000..5dd11c12
--- /dev/null
+++ b/ale_linters/clojure/clj_kondo.vim
@@ -0,0 +1,34 @@
+" Author: Masashi Iizuka <liquidz.uo@gmail.com>
+" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo
+
+function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
+ " output format
+ " <filename>:<line>:<column>: <issue type>: <message>
+ let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Exception|error|warning): ?(.+))$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ let l:type = 'E'
+
+ if l:match[4] is? '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': 'clj-kondo',
+\ 'output_stream': 'stdout',
+\ 'executable': 'clj-kondo',
+\ 'command': 'clj-kondo --lint %t',
+\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
+\})