Anyone using clj-kondo in Cursive? Maybe you could explain @reefersleep in #lsp what it adds to Cursive.
Ah, you are here :)
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?@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 definedthere's something beautifully optimistic about a linter assuming a user knows what they are doing 😆
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.
yeah, I think this could be improved
it you want to have a stab at this, it's in analyze-children
in clj-kondo.impl.analyzer
yes I'll create an issue and queue the work soon. just looking to add an exception for vars defined inside let
s?
(maybe binding
too? not sure if there are other things that usually wrap def
s... :thinking_face: )
I think let is the most common