From 3714b9c97609adc2b48b66c293259a0b5c3eddf6 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Thu, 25 Sep 2025 11:36:05 +0300 Subject: Improve clj-kondo hook --- resources/clj-kondo/hooks/dompa.clj | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'resources/clj-kondo/hooks/dompa.clj') diff --git a/resources/clj-kondo/hooks/dompa.clj b/resources/clj-kondo/hooks/dompa.clj index 31ab3d3..fb3b823 100644 --- a/resources/clj-kondo/hooks/dompa.clj +++ b/resources/clj-kondo/hooks/dompa.clj @@ -36,6 +36,19 @@ "or sequence of other nodes created with the $ macro.") :type :dompa.utils/$-arg-validation)) + ; if the first arg is a keyword, the second arg is a list, then + ; every arg has to be a list. + (and (api/keyword-node? first-arg) + (api/list-node? (first rest-args)) + (not (every? #(api/list-node? %) (rest rest-args)))) + (doall + (for [arg (filter #(not (api/list-node? %)) rest-args)] + (api/reg-finding! + (assoc (meta arg) + :message (str "Invalid argument type. Argument has to be a $ macro " + "or a sequence of $ macros.") + :type :dompa.utils/$-arg-validation)))) + ; if the first arg is a keyword, the second arg is a map, then from ; the second forwards everything has to be a list node (and (api/keyword-node? first-arg) -- cgit v1.2.3