Fork me on GitHub
#clj-kondo
<
2021-03-01
>
borkdude13:03:02

Anyone using clj-kondo in Cursive? Maybe you could explain @reefersleep in #lsp what it adds to Cursive.

👀 3
borkdude13:03:00

Ah, you are here :)

tomd16:03:51

I noticed today that the redefined-var linter picks up

(def foo 4)
(def foo 6)
but not
(let [bar 3]
  (def foo 4)
  (def foo 6))
is there a reason for not warning on the second example that I'm failing to see?

borkdude16:03:56

@tomd This has to do with what clj-kondo considers to be a top level form. E.g. this works:

(comment
  (def foo 4)
  (def foo 6))
but for some of the other constructs it just assumes the user knows what they are doing or the vars are conditionally defined

tomd16:03:42

there's something beautifully optimistic about a linter assuming a user knows what they are doing 😆

tomd16:03:00

but, yes, understood there will be some scenarios where that will be the case. I'm not sure let is often one of them - we have a few places in our codebase where we simply wrap a load of defs in a let to avoid lots of typing the same thing over and over.

borkdude17:03:09

yeah, I think this could be improved

borkdude17:03:30

it you want to have a stab at this, it's in analyze-children in clj-kondo.impl.analyzer

tomd17:03:09

yes I'll create an issue and queue the work soon. just looking to add an exception for vars defined inside lets?

tomd17:03:17

(maybe binding too? not sure if there are other things that usually wrap defs... :thinking_face: )

borkdude17:03:02

I think let is the most common

👍 3