Parse clj-kondo lines that don't include row/col (#3946)

Some custom linter hooks don't include these numbers.
This commit is contained in:
Randy Stauner 2021-10-19 00:04:50 -07:00 committed by GitHub
parent cb0f0e1d0b
commit 9b5a3581eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -16,7 +16,7 @@ endfunction
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:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+)?:(\d+)?:? ((Exception|error|warning): ?(.+))$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)

View File

@ -73,3 +73,17 @@ Execute(the clojure clj-kondo handler should be able to handle windows files):
\ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [
\ 'C:\my\operating\system\is\silly\core.clj:123:44: error: Unexpected )',
\ ])
Execute(the clojure clj-kondo handler should be able to lines without row/col):
AssertEqual
\ [
\ {
\ 'lnum': 0,
\ 'col': 0,
\ 'type': 'E',
\ 'text': 'error: Unexpected )',
\ },
\ ],
\ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [
\ 'test.clj::: error: Unexpected )',
\ ])