clj-kondo

grzm 2025-12-07T18:24:51.991049Z

I'm often interested in removing unused code. I really the :warn-on-reflection linter with clj-kondo. I'd also like to know when I've got (set! *warn-on-reflection* true) set unnecessarily. I don't see a linter for this currently. Is this something that's interesting to others as well?

borkdude 2025-12-10T10:09:59.595509Z

clj-kondo only warns about adding warn-on-reflection when you use Java interop. it can't actually see if reflection is happening or not, so it's purely looking at the presence of interop, not reflection. so it can't accurately tell you if reflection is going on, unless you don't use any interop

grzm 2025-12-10T10:33:25.901279Z

Sorry if I wasn't clear. I understand clj-kondo can't determine whether reflection is actually occurring, but it can detect whether or not there is Java interop. What I'm thinking is that if there is no Java interop, but (set! *warn-on-reflection* true) is present, it would warn that the set! is unnecessary. Does that make sense?

borkdude 2025-12-10T10:34:21.107549Z

I guess it does make sense, but personally I don't mind the set! being there in case I do add interop again in the future, which is very likely in any project

grzm 2025-12-10T10:35:39.658449Z

I can understand that. On the other hand, I prefer to only have code that is necessary. clj-kondo will advise me if I add some Java interop and once again require the set! 🙂

borkdude 2025-12-10T10:36:22.760689Z

issue (+ optional PR) welcome

👍 1
grzm 2025-12-10T10:37:30.146869Z

(Sleep is currently more welcome 🙂 I'll talk to you later 💤 )