Fork me on GitHub
#clj-kondo
<
2020-09-18
>
dharrigan20:09:42

Often, I have rich comment blocks that have blocks of vars that I redefine, to try things out (i.e., for different environments). Currently clj-kondo says this warning: redefined var

dharrigan20:09:58

Is there a way to ignore that for an entire function block?

dharrigan20:09:46

I wonder if #_:clj-kondo/ignore would work

dharrigan20:09:18

yes it does 🙂

dharrigan20:09:58

#_:clj-kondo/ignore
(comment
...
...
...
lots of redefining going on here...
...
...
,)

dharrigan20:09:38

oh, not quite...

dharrigan20:09:57

actually sorry, wrong it does 🙂

borkdude20:09:59

@dharrigan This seems to work for me:

(def x)
(def y)

#_:clj-kondo/ignore
(comment
  (def x)
  (def y)
  (def y)
  )

dharrigan20:09:17

I was confused about something that it rightly pointed out, but was at the top of the file

dharrigan20:09:20

yes, it works grand 🙂

borkdude20:09:32

@dharrigan More selectively:

(def x)
(def y)

#_{:clj-kondo/ignore[:redefined-var]}
(comment
  (def x)
  (def y)
  (def y)
  )

practicalli-johnny18:09:10

Excellent, this will make my live coding broadcasts have fewer warnings, thank you 🙂 Its now an Emacs snippet

practicalli-johnny19:09:45

Ah, it works now I upgraded clj-kondo (I was a release behind, inconceivable) Thanks for this excellent project.

dharrigan20:09:41

yes, works totally 100% fine 🙂

dharrigan20:09:44

party times! 🙂

dharrigan20:09:08

it found dead code 🙂

borkdude20:09:27

"I can see dead code"

dharrigan20:09:39

I had a def and a defn of the same name

dharrigan20:09:09

Of course, I could have just used :skip-comments true in my configuration 🙂