clj-kondo 2025-07-24

Hi, it looks like clj-kondo ignores claypoole config:

clj-kondo --debug --lint - <<< '(ns foo (:require [com.climate.claypoole :as cp])) (cp/upmap 5 inc (range 10))'   
[clj-kondo] Auto-loading config path: imports/taoensso/encore
[clj-kondo] Auto-loading config path: imports/babashka/fs
[clj-kondo] Auto-loading config path: imports/babashka/sci
[clj-kondo] Auto-loading config path: imports/adambard/failjure
[clj-kondo] Auto-loading config path: imports/potemkin/potemkin
[clj-kondo] Auto-loading config path: imports/clj-kondo/claypoole
[clj-kondo] Linting file: 
:1:52: error: Expected: function, received: seq.
linting took 11ms, errors: 1, warnings: 0
at the same time, the failjure config seems to work ok

clj-kondo --debug --lint - <<< '(ns foo (:require [failjure.core :as f])) (f/attempt-all [a 1] a)'   
[clj-kondo] Auto-loading config path: imports/taoensso/encore
[clj-kondo] Auto-loading config path: imports/babashka/fs
[clj-kondo] Auto-loading config path: imports/babashka/sci
[clj-kondo] Auto-loading config path: imports/adambard/failjure
[clj-kondo] Auto-loading config path: imports/potemkin/potemkin
[clj-kondo] Auto-loading config path: imports/clj-kondo/claypoole
[clj-kondo] Linting file: <stdin>
linting took 9ms, errors: 0, warnings: 0

find .clj-kondo/imports/
.clj-kondo/imports/
.clj-kondo/imports/taoensso
.clj-kondo/imports/taoensso/encore
.clj-kondo/imports/taoensso/encore/taoensso
.clj-kondo/imports/taoensso/encore/taoensso/encore.clj
.clj-kondo/imports/taoensso/encore/config.edn
.clj-kondo/imports/babashka
.clj-kondo/imports/babashka/fs
.clj-kondo/imports/babashka/fs/config.edn
.clj-kondo/imports/babashka/sci
.clj-kondo/imports/babashka/sci/config.edn
.clj-kondo/imports/babashka/sci/sci
.clj-kondo/imports/babashka/sci/sci/core.clj
.clj-kondo/imports/adambard
.clj-kondo/imports/adambard/failjure
.clj-kondo/imports/adambard/failjure/config.edn
.clj-kondo/imports/potemkin
.clj-kondo/imports/potemkin/potemkin
.clj-kondo/imports/potemkin/potemkin/config.edn
.clj-kondo/imports/potemkin/potemkin/potemkin
.clj-kondo/imports/potemkin/potemkin/potemkin/namespaces.clj
.clj-kondo/imports/clj-kondo
.clj-kondo/imports/clj-kondo/claypoole
.clj-kondo/imports/clj-kondo/claypoole/clj_kondo
.clj-kondo/imports/clj-kondo/claypoole/clj_kondo/claypoole.clj
.clj-kondo/imports/clj-kondo/claypoole/config.edn

what do you mean, ignore

it reports the error: <stdin>:1:52: error: Expected: function, received: seq.

but the .clj-kondo/imports/clj-kondo/claypoole/config.edn clearly states that

com.climate.claypoole/upmap              clj-kondo.claypoole/upmap

could also be an error in the configuration then?

I mean in the hook

it reproduces even with an empty ~/.clj-kondo/config.edn

can you insert a println in the claypool hook, to debug

clj-kondo --repro --debug --lint - <<< '(ns foo (:require [com.climate.claypoole.lazy :as cpl])) (cpl/upmap 5 inc (range 10))'   
[clj-kondo] Auto-loading config path: imports/taoensso/encore
[clj-kondo] Auto-loading config path: imports/babashka/fs
[clj-kondo] Auto-loading config path: imports/babashka/sci
[clj-kondo] Auto-loading config path: imports/adambard/failjure
[clj-kondo] Auto-loading config path: imports/potemkin/potemkin
[clj-kondo] Auto-loading config path: imports/clj-kondo/claypoole
[clj-kondo] Linting file: <stdin>
TOKEN: future
TOKEN: future
TOKEN: map
TOKEN: map
TOKEN: pvalues
TOKEN: pvalues
NODE: <list: (cpl/upmap 5 inc (range 10))>
<stdin>:1:58: error: Expected: function, received: seq.
linting took 12ms, errors: 1, warnings: 0

so the hook seems to be activated but might just be not completely correct?

clj-kondo --repro --debug --lint - <<< '(ns foo (:require [com.climate.claypoole.lazy :as cpl])) (cpl/upmap 5 inc (range 10))'   
[clj-kondo] Auto-loading config path: imports/taoensso/encore
[clj-kondo] Auto-loading config path: imports/babashka/fs
[clj-kondo] Auto-loading config path: imports/babashka/sci
[clj-kondo] Auto-loading config path: imports/adambard/failjure
[clj-kondo] Auto-loading config path: imports/potemkin/potemkin
[clj-kondo] Auto-loading config path: imports/clj-kondo/claypoole
[clj-kondo] Linting file: <stdin>
TOKEN: future
TOKEN: future
TOKEN: map
TOKEN: map
TOKEN: pvalues
TOKEN: pvalues
NODE: <list: (cpl/upmap 5 inc (range 10))>
NEWNODE:  <list: (map (do 5 inc (range 10)))>
<stdin>:1:58: error: Expected: function, received: seq.
linting took 12ms, errors: 1, warnings: 0

(defn pool-and-body
  [token]
  (println "TOKEN:" token)
  (fn [{:keys [:node]}]
    (println "NODE:" node)
    (let [[pool & body] (rest (:children node))
          new-node (api/list-node
                    [(api/token-node token)
                     (api/list-node
                      (list* (api/token-node 'do)
                             pool
                             body))])]
      (println "NEWNODE: " new-node)
      {:node (with-meta new-node
               (meta node))})))

I'm not familiar with hooks api, so not sure if it looks ok

just in case, I'm using clj-kondo v2025.06.05

seems a bug in the hook expansion:

$ clj -M:clj-kondo/dev --lint - <<< "(map (do 5 inc (range 10)))"
<stdin>:1:6: warning: Expected: function, received: seq.

that code doesn't make sense, map over a range

Is there anything I can help with?

and we need to fix the expansion into something that does make sense :)

looke like pool should be ignored

I think pool is in there because else you would get other warnings about unused things

but perhaps the expansion should become something like: (map (do 5 inc) ...)

👍 1

ok, I was able to get closer with this

(defn pool-and-body
  [token]
  (fn [{:keys [:node]}]
    (println "NODE:" node)
    (let [[pool f & colls] (rest (:children node))
          _ (println "COLLS " colls)
          new-node (api/list-node
                    [(api/token-node token)
                     (api/list-node (list* (api/token-node 'do) [pool f]))
                     (api/list-node colls)])]
      (println "NEWNODE: " new-node)
      {:node (with-meta new-node
               (meta node))})))
NEWNODE: but how do I implement something like unquote splicing? So ((range 10) (range 20)) becomes just (range 10) (range 20) ?

I'll be back later today, I have a meeting sorry

👍 1

list* is for creating lists with a list spliced at the end

kind of success:

(defn pool-and-body
  [token]
  (fn [{:keys [:node]}]
    (println "NODE:" node)
    (let [[pool f & colls] (rest (:children node))
          _ (println "COLLS " colls)
          new-node (api/list-node
                    (list* (api/token-node token)
                           (api/list-node (list* (api/token-node 'do) [pool f]))
                           colls))]
      (println "NEWNODE: " new-node)
      {:node (with-meta new-node
               (meta node))})))

NODE: <list: (cpl/upmap 5 inc (range 10) (range 20))>
NEWNODE:  <list: (map (do 5 inc) (range 10) (range 20))>

ok, I'm jumping back to work too, will create a PR later!

👍 1