clj-kondo

https://github.com/clj-kondo/clj-kondo
wilkerlucio 2020-05-29T15:41:11.266300Z

hello, I got in a situation here that I'm not sure how to get out, considering this code:

(let [init-link-events (mapv (fn [cid]
                                    [::command-init-link
                                     {::client-id cid}]) (range clients))]
       (gen/let [chain-size    (gen-chain-size env)
                 command-chain (gen-command (-> env
                                                (assoc ::chain-size chain-size)
                                                #_(update ::command-pool into init-link-events)))]
         (into init-link-events (chain->list command-chain))))
Kondo thinks there is a redundant let here, but its not really, I understand that for kondo they are just 2 lets, is there a way to avoid this problem?

wilkerlucio 2020-05-29T15:41:21.266500Z

gen/let vs let

wilkerlucio 2020-05-29T15:42:38.266900Z

and in my setup gen/let is configured to be resolved as let

borkdude 2020-05-29T15:43:27.267500Z

hmm, I think we need to tweak the code to disregard things that are linted as let, but are not really clojure.core/lets

borkdude 2020-05-29T15:46:46.268Z

@wilkerlucio a workaround for now would be to lint gen/let as core/with-open or something

borkdude 2020-05-29T15:47:06.268200Z

issue welcome

wilkerlucio 2020-05-29T17:59:42.268600Z

@borkdude sure, you think this is more a bug or feature request? I'm not sure

borkdude 2020-05-29T18:00:44.269200Z

I think for the redundant let check we should only look at clojure.core/let only, so I would say it's a bug in that linter

wilkerlucio 2020-05-29T18:04:16.269500Z

cool, another details that I got now: - clojure.test.check.generators/let is already recognized by kondo (before I said I had configured, but I hadn't) - Trying to make it work as with-open didn't fix got around it

wilkerlucio 2020-05-29T18:08:48.269900Z

https://github.com/borkdude/clj-kondo/issues/901

borkdude 2020-05-29T18:12:54.270500Z

thanks

borkdude 2020-05-29T22:39:36.271700Z

I also made a proposal for built-in support for core.match into clj-kondo for Summer of Bugs. https://github.com/borkdude/clj-kondo/issues/496 Please upvote the issue with a thumbs up if you'd like to see support for it.