clj-kondo

https://github.com/clj-kondo/clj-kondo
dharrigan 2020-09-18T20:06:42.001300Z

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

dharrigan 2020-09-18T20:06:58.001700Z

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

dharrigan 2020-09-18T20:07:46.002600Z

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

dharrigan 2020-09-18T20:08:16.002800Z

yes

dharrigan 2020-09-18T20:08:18.003Z

yes it does 🙂

dharrigan 2020-09-18T20:08:58.003500Z

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

dharrigan 2020-09-18T20:11:38.003700Z

oh, not quite...

dharrigan 2020-09-18T20:19:57.004100Z

actually sorry, wrong it does 🙂

borkdude 2020-09-18T20:19:59.004200Z

@dharrigan This seems to work for me:

(def x)
(def y)

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

dharrigan 2020-09-18T20:20:02.004400Z

it works

dharrigan 2020-09-18T20:20:17.004800Z

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

dharrigan 2020-09-18T20:20:20.005Z

yes, it works grand 🙂

borkdude 2020-09-18T20:20:32.005300Z

@dharrigan More selectively:

(def x)
(def y)

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

practicalli-john 2020-09-24T18:58:10.006700Z

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

borkdude 2020-09-24T19:01:44.006900Z

:thumbsup:

practicalli-john 2020-09-24T19:54:45.007200Z

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

borkdude 2020-09-24T20:01:02.007400Z

thanks!

dharrigan 2020-09-18T20:20:41.005600Z

yes, works totally 100% fine 🙂

dharrigan 2020-09-18T20:20:44.005800Z

party times! 🙂

borkdude 2020-09-18T20:20:48.006Z

🎉

dharrigan 2020-09-18T20:21:08.006200Z

it found dead code 🙂

borkdude 2020-09-18T20:23:27.006500Z

"I can see dead code"

dharrigan 2020-09-18T20:25:39.006900Z

I had a def and a defn of the same name

dharrigan 2020-09-18T20:38:09.007400Z

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