summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandy Stauner <randy@r4s6.net>2021-10-19 00:04:50 -0700
committerGitHub <noreply@github.com>2021-10-19 16:04:50 +0900
commit9b5a3581ebb7e6e1ccb0cbaeef5358aee57d734e (patch)
tree6efa711bba67d09190fb1141d0044d39c8ce0716
parentcb0f0e1d0b2b189fbfb32b8ccbbc5efbed2cd7f0 (diff)
downloadale-9b5a3581ebb7e6e1ccb0cbaeef5358aee57d734e.zip
Parse clj-kondo lines that don't include row/col (#3946)
Some custom linter hooks don't include these numbers.
-rw-r--r--ale_linters/clojure/clj_kondo.vim2
-rw-r--r--test/handler/test_clojure_clj_kondo_handler.vader14
2 files changed, 15 insertions, 1 deletions
diff --git a/ale_linters/clojure/clj_kondo.vim b/ale_linters/clojure/clj_kondo.vim
index e3f93b6b..a023f8b6 100644
--- a/ale_linters/clojure/clj_kondo.vim
+++ b/ale_linters/clojure/clj_kondo.vim
@@ -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)
diff --git a/test/handler/test_clojure_clj_kondo_handler.vader b/test/handler/test_clojure_clj_kondo_handler.vader
index 45db9049..9ae70668 100644
--- a/test/handler/test_clojure_clj_kondo_handler.vader
+++ b/test/handler/test_clojure_clj_kondo_handler.vader
@@ -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 )',
+ \ ])