clj-kondo

a13 2025-07-24T10:55:29.006049Z

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

a13 2025-07-26T08:02:03.775339Z

related https://github.com/clj-kondo/configs/pull/6

a13 2025-07-24T10:55:50.934259Z

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

a13 2025-07-24T10:56:03.867639Z

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

borkdude 2025-07-24T11:09:34.242149Z

what do you mean, ignore

a13 2025-07-24T11:10:11.411829Z

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

a13 2025-07-24T11:11:03.543039Z

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

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

borkdude 2025-07-24T11:11:12.078869Z

could also be an error in the configuration then?

borkdude 2025-07-24T11:11:25.294969Z

I mean in the hook

a13 2025-07-24T11:12:10.899259Z

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

borkdude 2025-07-24T11:12:41.007209Z

ok got it

borkdude 2025-07-24T11:12:52.234679Z

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

a13 2025-07-24T11:13:09.797249Z

sure, 1min

a13 2025-07-24T11:14:07.255769Z

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

borkdude 2025-07-24T11:15:26.207329Z

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

a13 2025-07-24T11:15:52.419759Z

looks like this

a13 2025-07-24T11:16:27.298189Z

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

a13 2025-07-24T11:16:39.292339Z

(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))})))

a13 2025-07-24T11:17:28.569919Z

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

a13 2025-07-24T11:19:28.519469Z

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

borkdude 2025-07-24T11:20:00.026879Z

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.

borkdude 2025-07-24T11:20:11.203129Z

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

a13 2025-07-24T11:20:16.750609Z

yeah...

a13 2025-07-24T11:20:44.343739Z

Is there anything I can help with?

borkdude 2025-07-24T11:21:41.839269Z

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

a13 2025-07-24T11:24:07.896829Z

looke like pool should be ignored

borkdude 2025-07-24T11:26:25.743579Z

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

a13 2025-07-24T11:26:54.481659Z

I see

borkdude 2025-07-24T11:26:56.347339Z

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

👍 1
a13 2025-07-24T11:44:58.068279Z

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) ?

borkdude 2025-07-24T11:47:35.963569Z

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

👍 1
borkdude 2025-07-24T11:47:50.989039Z

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

a13 2025-07-24T11:57:13.569319Z

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))})))

a13 2025-07-24T11:57:43.218809Z

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

a13 2025-07-24T11:58:25.241799Z

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

👍 1