clj-kondo / configs

Library configurations as dependencies for clj-kondo
MIT License
12 stars 2 forks source link

`claypoole/pmap` expects to be passed functions for the seq arguments #5

Open miridius opened 5 days ago

miridius commented 5 days ago

I'm using clj-kondo v2024.08.29. This happens in both the native and JVM versions

With empty configs apart from io.github.clj-kondo/config-org.clj-commons-claypoole {:mvn/version "1.0.1"}, cp/pmap emits a linter error when you pass a seq(able) as the coll, saying it expects functions:

❯ clj-kondo --lint - <<< '(ns foo (:require [com.climate.claypoole :as cp])) (cp/pmap 5 inc (range 10))'      
<stdin>:1:52: error: Expected: function, received: seq.
linting took 17ms, errors: 1, warnings: 0

This tests in https://github.com/clj-kondo/configs/blob/main/configs/org.clj-commons/claypoole/test/clj_kondo/claypoole_test.clj pass only because the examples use a vector for the coll, and vectors happen to be functions too

Fixing this via global config overrides doesn't seem to work. I tried: {:lint-as {com.climate.claypoole/pmap clojure.core/do}} and {:linters :type-mismatch {:namespaces {com.climate.claypoole {pmap {:arities {:varargs {:args [{:op :rest :spec :any}] :ret :seq}}}} but the error persists

borkdude commented 5 days ago

I’m at a conference right now but I can look afterwards

https://www.michielborkent.nl https://www.eetvoorjeleven.nu

On Wed, 18 Sep 2024 at 10:10, Dave Rolle @.***> wrote:

I'm using clj-kondo v2024.08.29. This happens in both the native and JVM versions

With empty configs apart from io.github.clj-kondo/config-org.clj-commons-claypoole {:mvn/version "1.0.1"}, cp/pmap emits a linter error when you pass a seq(able) as the coll, saying it expects functions:

❯ clj-kondo --lint - <<< '(ns foo (:require [com.climate.claypoole :as cp])) (cp/pmap 5 inc (range 10))' :1:52: error: Expected: function, received: seq. linting took 17ms, errors: 1, warnings: 0

This tests in https://github.com/clj-kondo/configs/blob/main/configs/org.clj-commons/claypoole/test/clj_kondo/claypoole_test.clj pass only because the examples use a vector for the coll, and vectors happen to be functions too

Fixing this via global config overrides doesn't seem to work. I tried: {:lint-as {com.climate.claypoole/pmap clojure.core/do}} and {:linters :type-mismatch {:namespaces {com.climate.claypoole {pmap {:arities {:varargs {:args [{:op :rest :spec :any}] :ret :seq}}}} but the error persists

— Reply to this email directly, view it on GitHub https://github.com/clj-kondo/configs/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFSBXXDUSQRIE4O72ZDSDZXEYQHAVCNFSM6AAAAABONDKCRCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUZTGMBTGE4DEOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

borkdude commented 20 hours ago

@miridius Since you know the solution, could you make a PR that updates the test code and the configuration?