Fork me on GitHub
#clj-kondo
<
2020-05-29
>
wilkerlucio15:05:11

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?

wilkerlucio15:05:21

gen/let vs let

wilkerlucio15:05:38

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

borkdude15:05:27

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

borkdude15:05:46

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

borkdude15:05:06

issue welcome

wilkerlucio17:05:42

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

borkdude18:05:44

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

wilkerlucio18:05:16

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

borkdude22:05:36

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.