Fork me on GitHub
#clj-kondo
<
2019-09-18
>
borkdude21:09:05

just fyi, I have ditched spec and working on my own "spec" format. it's much faster and less powerful, but ok enough for this purpose. I want to allow users to provide their own function types (like C headers maybe) in the config. it would look a bit like:

'map {:arities {1 {:arg-tags [::ifn]
                      :ret-tag ::transducer}
                   :varargs {:arg-tags '[::ifn ::seqable (* ::seqable)]
                             :ret-tag ::seqable-out}}}
work is in progress in the ret-types branch

🧠 4
borkdude21:09:40

(the format will change, just the general idea)

borkdude21:09:36

These are the types for assoc which will allow catching an uneven amount of args:

:arg-tags '[::nilable-associative ::any ::any (* [::any ::any])]
$ echo '(assoc {} 1 2 3)' | clj-kondo --lint -
<stdin>:1:15: error: Insuffient input.

robertfw22:09:49

Is spec that difficult of a target to work with? We have s/fdefs for any of our publicly facing functions and it'd be great to have something that ties into that

borkdude22:09:24

I bet there's more sources that can be used to derive data that clj-kondo can work with, e.g. schema.core/defn

borkdude22:09:59

your fdefs can refer to other specs in another place in your code base, that's at least one challenge

lilactown22:09:18

spec is just not really designed for static analysis. I think if it were, it would look quite different