clj-kondo

djblue 2025-10-10T19:52:56.766689Z

A common hack I use when using :deprecated metadata, is putting info in the string pointing at the var to use instead, kinda like https://guide.clojure.style/#superseded-by. However, I don't think clj-kondo knows about this piece of metadata though. Is superseded-by something that clj-kondo could look at when generating the message for deprecated vars?

borkdude 2025-10-10T20:15:59.909669Z

It only looks at the value of :deprecated so you could put "Superseded by .." in that string and it will be displayed in the message

djblue 2025-10-10T20:17:58.057799Z

Yeah, that makes sense. I was just thinking it would be cool if the generated message could reference superseded-by automatically for me, since they are so tightly related.

djblue 2025-10-10T20:19:11.110329Z

If this is something you think is worth doing, I'm also down to try and add the functionality.

borkdude 2025-10-10T20:21:07.854169Z

I didn't know it was that common, thanks for pointing that out. https://github.com/search?q=%22%3Asuperseded-by%22+language%3AClojure&type=code&l=Clojure Yes, issue + PR welcome

djblue 2025-10-10T20:22:56.656079Z

I do think it might not been super popular, but more support should encourage more usage. Do you mind providing some pointers on where in the code I should start looking to add this?

borkdude 2025-10-10T20:23:46.255599Z

yeah, just look at how deprecated var and ns is implemented, search for :deprecated-var for example. it should be pretty obvious

borkdude 2025-10-10T20:23:56.960219Z

and if you have any questions, let me know

djblue 2025-10-10T20:24:08.810299Z

Awesome, thanks 🙏

dgr 2025-10-10T21:05:04.936529Z

Just stumbled on an interesting bit of code that clj-kondo should probably flag with a warning. After doing a bunch of consolidation of some code into a single namespace and renaming things, etc., etc. (imagine lots of hammering and power tool sounds), I ended up with some cruft in the ns form of one namespace that clj-kondo passed over without flagging anything. Essentially, I had a reference to the namespace I was defining in its own :require form. Simplified:

(ns bar.foo
  (:require [bar.foo :as foo]))
This should probably elicit a warning (and perhaps a gentle slap upside the head).

borkdude 2025-10-23T10:41:58.436989Z

done

👍 1
borkdude 2025-10-10T21:06:48.949509Z

It already warns about this:

borkdude 2025-10-10T21:07:12.635669Z

maybe not by default:

:self-requiring-namespace {:level :warning}

borkdude 2025-10-10T21:07:18.663839Z

we could make that the default I guess

dgr 2025-10-10T21:09:52.097889Z

OK. Yea, I’m using default settings, so it wasn’t saying anything about it. What is the criteria for making something checked by default or not? Or to put it another way, why not just enable almost everything by default, unless something is particularly noisy?

borkdude 2025-10-10T21:10:49.764849Z

With non-critical things I usually don't enable them right away by default so I can test drive them a bit longer before bothering people with false positives, but this one has been around for a while, we could probably flip it to default

dgr 2025-10-10T21:11:34.874729Z

Makes sense.

borkdude 2025-10-10T21:11:56.478469Z

I'll make a note and do it tomorrow

👍 2