2018-03-31 10:55:20 -04:00
|
|
|
" 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'
|
2018-09-24 20:40:17 -04:00
|
|
|
|
2018-03-31 10:55:20 -04:00
|
|
|
if l:match[4] is? 'Parse warning'
|
2019-03-08 06:04:56 -05:00
|
|
|
let l:type = 'W'
|
2018-03-31 10:55:20 -04:00
|
|
|
endif
|
2018-09-24 20:40:17 -04:00
|
|
|
|
2018-03-31 10:55:20 -04:00
|
|
|
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',
|
2018-07-30 17:18:16 -04:00
|
|
|
\ 'command': 'joker --working-dir %s --lint %t',
|
2018-03-31 10:55:20 -04:00
|
|
|
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
|
|
|
\})
|