hello everyone, I am trying to lint a defrecord but it seems like I am not getting unresolved vars reported, I am trying this snippet in the lint playground:
(+ a b)
(defrecord wow [a b]
(some [_]
(+ a b whatisthis)))
I can get a
and b
to report correctly in my first statement, but whatisthis
is not being reported as unrecognized/unresolved
oof
I think there is some syntax problem, I cannot declare that function some
without an interface/symbol of somekind
Trying with this now:
(+ a b)
(defprotocol IAbc
(doit [_]))
(defrecord abc [a b]
IAbc
(doit [_]
(+ a b whatisthis)))
still doesn't seem like its being reported, am I missing something?
@verma clj-kondo might not have good analysis yet for the protocols part of defrecord, I’ll take a look when I’m at a keyboard
thanks @borkdude :thumbsup:
I am trying to write an analyzer for defcomponentk
from https://github.com/plumatic/om-tools/blob/master/src/om_tools/core.cljc#L257 using the new :hooks stuff in clj-kondo
@verma awesome! I checked and clj-kondo has pretty crude analyzing for defrecord's protocol parts at the moment. it basically lints it, with some things turned off. https://github.com/borkdude/clj-kondo/blob/466930149b0c8c3b50fab0df5c6d2fb482a03cb8/src/clj_kondo/impl/analyzer.clj#L926 There is room for improvement there, but now you know why it is like it is.
There is an old issue for it: https://github.com/borkdude/clj-kondo/issues/140 But I never got to it yet.
Meanwhile I did implement protocols in babashka/sci, so at least I have more understanding of it now 😉
Bumped it a little bit in the "medium priority" column: https://github.com/borkdude/clj-kondo/projects/1
thanks so much!