mirror of https://github.com/dense-analysis/ale
Add option to clojure clj-kondo linter (#3812)
Allow define `clojure_clj_kondo_options` to customize command options for `clj-kondo`. The `--cache` in original command is now defined as default.
This commit is contained in:
parent
a6a8131306
commit
f83a1f70d5
|
@ -1,6 +1,18 @@
|
|||
" Author: Masashi Iizuka <liquidz.uo@gmail.com>
|
||||
" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo
|
||||
|
||||
call ale#Set('clojure_clj_kondo_options', '--cache')
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'clojure_clj_kondo_options')
|
||||
|
||||
let l:command = 'clj-kondo'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --lint %t'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
|
||||
" output format
|
||||
" <filename>:<line>:<column>: <issue type>: <message>
|
||||
|
@ -29,6 +41,6 @@ call ale#linter#Define('clojure', {
|
|||
\ 'name': 'clj-kondo',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'clj-kondo',
|
||||
\ 'command': 'clj-kondo --cache --lint %t',
|
||||
\ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'),
|
||||
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
|
||||
\})
|
||||
|
|
|
@ -9,6 +9,14 @@ A minimal and opinionated linter for code that sparks joy.
|
|||
|
||||
https://github.com/borkdude/clj-kondo
|
||||
|
||||
g:ale_clojure_clj_kondo_options *g:ale_clojure_clj_kondo_options*
|
||||
*b:ale_clojure_clj_kondo_options*
|
||||
Type: |String|
|
||||
Default: `'--cache'`
|
||||
|
||||
This variable can be changed to modify options passed to clj-kondo.
|
||||
|
||||
|
||||
===============================================================================
|
||||
joker *ale-clojure-joker*
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
Before:
|
||||
call ale#assert#SetUpLinterTest('clojure', 'clj_kondo')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'clj-kondo', 'clj-kondo'
|
||||
\ . ' --cache --lint %t'
|
||||
|
||||
Execute(Extra options should be supported):
|
||||
let g:ale_clojure_clj_kondo_options = '--config ./clj-kondo/config.edn'
|
||||
|
||||
AssertLinter 'clj-kondo', 'clj-kondo'
|
||||
\ . ' --config ./clj-kondo/config.edn --lint %t'
|
Loading…
Reference in New Issue