Fork me on GitHub
#clj-kondo
<
2020-06-25
>
verma05:06:51

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)))

verma05:06:29

I can get a and b to report correctly in my first statement, but whatisthis is not being reported as unrecognized/unresolved

verma05:06:53

I think there is some syntax problem, I cannot declare that function some without an interface/symbol of somekind

verma05:06:50

Trying with this now:

(+ a b)


(defprotocol IAbc
  (doit [_]))

(defrecord abc [a b]
  IAbc
  (doit [_]
    (+ a b whatisthis)))

verma05:06:59

still doesn't seem like its being reported, am I missing something?

borkdude05:06:19

@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

verma05:06:03

thanks @borkdude :thumbsup:

verma06:06:02

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

borkdude08:06:46

@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.

borkdude08:06:55

There is an old issue for it: https://github.com/borkdude/clj-kondo/issues/140 But I never got to it yet.

borkdude08:06:22

Meanwhile I did implement protocols in babashka/sci, so at least I have more understanding of it now 😉

borkdude08:06:28

Bumped it a little bit in the "medium priority" column: https://github.com/borkdude/clj-kondo/projects/1

verma17:06:33

thanks so much!