https://clojurians.slack.com/archives/C06MAR553/p1737042813783249
Hey Michiel, I'm upgrading to this version and also trying out min-version and found a warning that I don't expect:
; echo '{:min-clj-kondo-version "3030-01-01"}' > .clj-kondo/config.edn
; clj-kondo --lint .clj-kondo/config.edn
.clj-kondo/config.edn:1:2: warning: Linter config should go under :linters
:1:1: warning: Version 2025.01.16 below configured minimum 3030-01-01
linting took 47ms, errors: 0, warnings: 2 why don't you expect this warning?
.clj-kondo/config.edn:1:2: warning: Linter config should go under :linters
sorry I wasn't specific enough
https://github.com/clj-kondo/clj-kondo/issues/2362 says I should provide the min version as a top-level key
ah ok, thanks. never seen this one before. Perhaps you can file an issue?
absolutely
also, would it make sense to perhaps set the location of the actual version warning to the line where the min version is specified?
that's a bit harder than it looks since this setting may come from an arbitrary set of merged files that we don't track the origin of
this is why it says <clj-kondo> and not <stdin> or whatever
Hmm gotcha. And I suppose it wouldn't make sense to always put it on line one of .clj-kondo/config.edn either, given there might not be an actual config.edn?
right
what if it's put there if that file exists (is among the ones being linted) and left like the current one otherwise? usecase: IDE tooling can display an inline squiggly line if there is a file to show it in
sounds reasonable, are you willing to provide a PR?
optional of course. issue about this is welcome
I might be able to. Let me raise an issue and if you could give me (or someone else) a few pointers there I'll try to find time for it
yeah, I could give pointers
you'll need to parse the .clj-kondo/config.edn file with rewrite-clj and find the location of the value for the min-clj-kondo-version key, that's mostly it.
https://github.com/clj-kondo/clj-kondo/issues/2463 for the original problem I found
Thanks a mill!
I think one reason not to implement this is that often IDE users can't immediately update the clj-kondo version (e.g. when you're using clojure-lsp)
so this thing is often used in CI only
I vaguely remember that discussion, perhaps it's in the related issue when this was implemented
hmm. The original ticket is here https://github.com/clj-kondo/clj-kondo/issues/2362 > often IDE users can't immediately update the clj-kondo version perhaps the proposed behavior could be behind a flag in the linter config? I would want to know when my bundled kondo is too old so I can make a pr/issue/custom build to update it.
yeah, let's just do it the way I proposed. there's also some deps.edn-specific linting in clj-kondo so there you can probably look how stuff works as well
for sure, thanks
ah, I just realized version strings should be .-delimited as in versions, not - as in iso dates
specifying it properly now reveals that my ide seems to mark the entire config as errory with the current <clj-kondo>:1:1 location
I guess this solves the part that I am notified about it being outdated
ah I didn't know that
but I wager it would still be an improvement to focus it onto the value if it's available?
I guess this is just because Cursive does something with the warning instead of just ignoring it, dunno
It's clj-extras actually. My guess is that if it cannot locate the warning back to a file it will just mark the entire config
yeah
checking the extended discouraged var linter:
; echo '(map inc (range 5))' | clj-kondo --config '{:linters {:discouraged-var {clojure.core/map {:arities #{2, 3, 4, :varargs}}}}}' --lint -
linting took 51ms, errors: 0, warnings: 0
; echo '(map inc (range 5))' | clj-kondo --config '{:linters {:discouraged-var {clojure.core/map {}}}}' --lint -
<stdin>:1:1: warning: Discouraged var: clojure.core/map
linting took 25ms, errors: 0, warnings: 1
why does the first command not give a warning?; clj-kondo -version | head -n 1
clj-kondo v2025.01.16
no luck this way either:
; echo '(map inc [1 2 3])' | clj-kondo --config '{:linters {:discouraged-var {clojure.core/map {:level :warning, :arities #{1, 2, 3, 4, :varargs}}}}}' --lint -
Seems to work for this case though:
; echo '(partial map inc)' | clj-kondo --config '{:linters {:discouraged-var {clojure.core/map {:arities #{2, 3, 4, :varargs}}}}}' --lint -
<stdin>:1:10: warning: Discouraged var: clojure.core/map
linting took 61ms, errors: 0, warnings: 1Happy to record an issue if this turns out to not be a user error on my end
I'm getting:
$ echo '(map inc (range 5))' | clj-kondo --config '{:linters {:discouraged-var {clojure.core/map {:arities #{2, 3, 4, :varargs}}}}}' --lint -
<stdin>:1:1: warning: Discouraged var: clojure.core/mapHmm what the hell
never mind, my binary is out of date, let me try the JVM version
Thsi is with the brww installed one
yeah seems like a bug. also I notice I copy pasted a lint warning about something else which should have been a discouraged var facepalm https://github.com/clj-kondo/clj-kondo/commit/971f90aaf4d9fe6543f0488a8cc6b1541a2cd974#diff-253b0be1bbe77f23a3283f4af26053ac71022a6b6bda2bd39583dc7fc182dadeR121 please mention that in the issue as well
Sure thing
Thank you for the awesome work you do! clj-kondo is an absolute gem.
do you have a rough idea when a new version would be released?
I'm in the middle of upgrading graalvm which I'll merge tomorrow but I don't have time the rest of the day, but I could do a release thursday or so.
That would be lovely, I'm looking forward to seeing the recent improvements released. Thank you
Submitted PRs addressing #2463 and #2464
Thanks, it's on my list to review!