clj-kondo

grzm 2024-12-02T22:47:22.835539Z

I've got a case where I'm deliberately discarding a value and clj-kondo is helpfully (and understandably) reporting warning: Unused value. When I add a hint #_{:clj-kondo/ignore [:unused-value]}, I then get info: Redundant ignore. What might I be misunderstanding? Concrete example:

% cat src/com/grzm/ex/claypoole_lint.clj
(ns com.grzm.ex.claypoole-lint
  (:require [com.climate.claypoole :as cp]))

(defn -main [& _args]
  (cp/upfor (cp/threadpool 5) [_ (range 5)]
            (fn [] println))
  :do-other-work)

% cat src/com/grzm/ex/claypoole_lint.clj
(ns com.grzm.ex.claypoole-lint
  (:require [com.climate.claypoole :as cp]))

(defn -main [& _args]
  (cp/upfor (cp/threadpool 5) [_ (range 5)]
            (fn [] println))
  :do-other-work)

% clj-kondo --version
clj-kondo v2024.11.14

grzm 2024-12-02T22:47:45.497939Z

After adding hint:

% cat src/com/grzm/ex/claypoole_lint.clj
(ns com.grzm.ex.claypoole-lint
  (:require [com.climate.claypoole :as cp]))

(defn -main [& _args]
  #_{:clj-kondo/ignore [:unused-value]}
  (cp/upfor (cp/threadpool 5) [_ (range 5)]
            (fn [] println))
  :do-other-work)

% clj-kondo --lint src                  
src/com/grzm/ex/claypoole_lint.clj:5:5: info: Redundant ignore
linting took 55ms, errors: 0, warnings: 0

borkdude 2024-12-02T22:50:30.761539Z

It's likely that you're hitting an issue that was fixed here: https://github.com/clj-kondo/clj-kondo/commit/268a9734c65b184da79fe8df705d21d0482bd210 can you perhaps try linting with the JVM version and a git sha?

👍 1
grzm 2024-12-02T22:51:56.863679Z

Meaning build clj-kondo from git? Or something else?

grzm 2024-12-02T22:53:21.081389Z

Sorry, a bit slow. I see what you're saying.

borkdude 2024-12-02T22:53:53.383279Z

yeah just with clj -Sdeps ... -M -m clj-kondo.main and then with the normal CLI args

grzm 2024-12-02T22:56:53.725279Z

% cat src/com/grzm/ex/claypoole_lint.clj
(ns com.grzm.ex.claypoole-lint
  (:require [com.climate.claypoole :as cp]))

(defn -main [& _args]
  #_{:clj-kondo/ignore [:unused-value]}
  (cp/upfor (cp/threadpool 5) [_ (range 5)]
            (fn [] println))
  :do-other-work)

% rm -r .clj-kondo/.cache 

% clj -Sdeps '{:deps {clj-kondo/clj-kondo {:git/url "" :git/sha "32447447cc6b26c3b7e40dac8135174e6a88253d"}}}' -M -m clj-kondo.main --lint src
src/com/grzm/ex/claypoole_lint.clj:5:5: info: Redundant ignore
linting took 85ms, errors: 0, warnings: 0
Same thing. Am I doing that right?

borkdude 2024-12-02T22:58:12.591209Z

yeah seems right, it's a pity that it didn't solve your problem

grzm 2024-12-02T22:58:22.578459Z

(For completeness, I've also copied the current claypoole clj-kondo configs from claypoole master)

borkdude 2024-12-02T22:58:54.980319Z

can you file an issue, preferably with repro?

grzm 2024-12-02T22:59:12.935689Z

I will. Thanks!

🙏 1
borkdude 2024-12-02T22:59:13.212469Z

for now you could just disable the redundant-ignore linter

👍 1
grzm 2024-12-03T00:05:59.369179Z

For those playing along at home: https://github.com/clj-kondo/clj-kondo/issues/2446

👍 1
grzm 2024-12-03T15:16:21.742319Z

Thanks!

🎉 1