clj-kondo / clj-kondo

Static analyzer and linter for Clojure code that sparks joy
Eclipse Public License 1.0
1.71k stars 295 forks source link

`stream-` functions from Clojure 1.12 are not supported #2392

Closed roman-rudakov closed 2 months ago

roman-rudakov commented 2 months ago

version

clj-kondo v2024.08.29

platform

MacOS, homebrew.

editor

Emacs 30

problem

Some functions from Clojure 1.12 are not supported:

repro

(ns repro)

(stream-seq! (java.util.stream.Stream/of 1))

Output or clj-condo --lint repro.clj

repro.clj:3:2: error: Unresolved symbol: stream-seq!
linting took 11ms, errors: 1, warnings: 0
borkdude commented 2 months ago

Already fixed on master

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

On Wed, 11 Sep 2024 at 12:03, Roma Rudakov @.***> wrote:

version

clj-kondo v2024.08.29

platform

MacOS, homebrew.

editor

Emacs 30

problem

Some functions from Clojure 1.12 are not supported:

  • stream-seq!
  • stream-into!
  • stream-reduce!
  • stream-transduce!

repro

(ns repro)

(stream-seq! (java.util.stream.Stream/of 1))

Output or clj-condo --lint repro.clj

repro.clj:3:2: error: Unresolved symbol: stream-seq! linting took 11ms, errors: 1, warnings: 0

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

roman-rudakov commented 2 months ago

Nice, thanks! Waiting for the next release then.

borkdude commented 2 months ago

@roman-rudakov You can have this working right now by just using clojure 1.12 in your deps.edn and linting the dependencies like this:

clj-kondo --lint "$(clojure -Sdeps)" --dependencies 
roman-rudakov commented 2 months ago

I already have clojure 1.12 in my deps.edn and I run clj-kondo as clj-kondo --lint src test env, where src, test and env are just directories in my classpath.

If I run:

clj-kondo --lint "$(clojure -Sdeps)" --dependencies 

with some syntax error in the sources, it doesn't report it at all.

According to the help -Sdeps also expects an argument:

-Sdeps EDN     Deps data to use as the last deps file to be merged

If I run clojure -Sdeps in the project root, I'm getting an empty output.

Considering this I'm not really sure how to make clj-kondo using clojure 1.12 properly for my project.

borkdude commented 2 months ago
clj-kondo --lint "$(clojure -Spath)" --dependencies 

is what I meant.

Please follow the documentation here:

https://github.com/clj-kondo/clj-kondo?tab=readme-ov-file#project-setup

roman-rudakov commented 2 months ago

ah, yes, I tried it. I usually run the following to refresh the cache, it doesn't fix the problem for me:

clj-kondo --copy-configs --dependencies --lint "$(clojure -Spath)"
roman-rudakov commented 2 months ago

Looks like I had to manually remove .clj-kondo/.cache before running this. Sorry. Now it works for me.

borkdude commented 2 months ago

you shouldn't have had to remove the .cache, normally, so not sure what caused this

roman-rudakov commented 2 months ago

Not sure what's wrong, but I cannot make it work on CI and locally it's not really stable.

The minimal reproducible example:

  1. mkdir bug
  2. create file bug/deps.edn:
    {:paths ["src"]
    :deps  {org.clojure/clojure {:mvn/version "1.12.0"}}}
  3. create file bug/src/core.clj
    
    (ns core)

(stream-seq! (java.util.stream.Stream/of 1))

4. `mkdir bug/.clj-kondo`
5. `cd bug`
6. Run:

clj-kondo --lint "$(clojure -Spath)" --dependencies --copy-configs

Output:

No configs copied. [clj-kondo] clojure-1.12.0.jar was already linted, skipping [clj-kondo] core.specs.alpha-0.4.74.jar was already linted, skipping [clj-kondo] spec.alpha-0.5.238.jar was already linted, skipping

7. Run:

clj-kondo --lint src

Output:

src/core.clj:3:2: error: Unresolved symbol: stream-seq! linting took 24ms, errors: 1, warnings: 0

borkdude commented 2 months ago

OK, I'll try your repro.

borkdude commented 2 months ago

This seems weird, since there is no cache, it can't already be linted:

[clj-kondo] clojure-1.12.0.jar was already linted, skipping
roman-rudakov commented 2 months ago

Michiel Borkent @.***> writes:

This seems weird, since there is no cache, it can't already be linted:

Yes, I also noticed it. That's why I decided to try fresh minimal project. I also tried to cleanup .clj-kondo/.cache and .cpcache/ which is created in the project root, but the output is still the same.

-- Best regards, Roman

borkdude commented 2 months ago

I believe I have the solution but CI isn't co-operating.