clj-kondo 2026-04-06

per a discussion in https://clojure.atlassian.net/browse/CLJ-2953, i wonder if clj-kondo should warn on 0-arity uses of eduction:

$ echo "(eduction)" | clj-kondo --lint -
linting took 8ms, errors: 0, warnings: 0

✅ 1

what bad things can happen? what does Alex say?

the arglist and docstring contract is 0+ xforms, 1 coll

the impl works if you provide no collection, but it's "undefined behavior"

in the future, the contract might be made explicit and throw if called without a collection

how common is this error now?

usage of (eduction) seems to be very limited (2-5 instance on github)

my proposal would be an entry in the args.clj file that has like eduction {:1 {:1 seq :ret any} {:varargs ...}}

(i don't remember the specific format, my apologies)

this still doesn't report anything I think, since clj-kondo will also see the varargs signature in the source code

the thing you're mentioning is just for the type system

👍 1

but if the source code changes, then clj-kondo will start reporting too

Perhaps those weird (eduction) cases on github are because people just needed something of type Eduction

that's very possible

(cc @alexmiller we're discussing that eduction ticket)

so a backward compatible way of handling this would be (eduction '()) as the result of (eduction) perhaps

right, alex actually opened an issue about this in one of the cases: https://github.com/uncomplicate/fluokitten/issues/29

Alex Miller (Clojure team) 2026-04-06T20:47:38.388779Z

re the existing uses - yes, I think that's all it is

Alex Miller (Clojure team) 2026-04-06T20:47:59.064949Z

I opened ones for fluokitten and malli. the other ones from Ambrose all seem like tests

👍 2

cool, then never mind. seems folks are using it correctly and we can probably ignore unintended zero-arg arity

Alex Miller (Clojure team) 2026-04-06T20:53:05.225759Z

fluokitten's issue already closed and fixed :)

i've updated the jira ticket with a patch removing the 0-arg arity, so this will be a non-issue when rich reviews and merges my code later this evening 😉

🚀 1
Alex Miller (Clojure team) 2026-04-06T21:04:18.116969Z

ha