diff options
| author | Asko Nõmm <asko@nmm.ee> | 2025-09-25 11:36:05 +0300 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2025-09-25 11:36:05 +0300 |
| commit | 3714b9c97609adc2b48b66c293259a0b5c3eddf6 (patch) | |
| tree | b3fcb0dc7a0cb2221cddee21fb8caf526686f028 /resources/clj-kondo/hooks/dompa.clj | |
| parent | d98e13761fdcaa8cba912d367670855087b29c01 (diff) | |
Improve clj-kondo hook
Diffstat (limited to 'resources/clj-kondo/hooks/dompa.clj')
| -rw-r--r-- | resources/clj-kondo/hooks/dompa.clj | 13 |
1 files changed, 13 insertions, 0 deletions
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) |
