This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-05
Channels
- # adventofcode (89)
- # announcements (9)
- # babashka (11)
- # beginners (8)
- # biff (5)
- # calva (4)
- # cherry (121)
- # clara (15)
- # clerk (16)
- # clj-kondo (20)
- # clj-otel (2)
- # cljdoc (20)
- # clojure (84)
- # clojure-austin (1)
- # clojure-bay-area (3)
- # clojure-berlin (1)
- # clojure-czech (2)
- # clojure-europe (59)
- # clojure-nl (1)
- # clojure-norway (12)
- # clojure-poland (1)
- # clojure-uk (15)
- # cursive (16)
- # datomic (46)
- # events (3)
- # fulcro (85)
- # graalvm (20)
- # hyperfiddle (11)
- # improve-getting-started (1)
- # lsp (7)
- # off-topic (48)
- # overtone (8)
- # podcasts-discuss (4)
- # re-frame (31)
- # releases (1)
- # ring (12)
- # sci (13)
- # shadow-cljs (8)
- # specter (3)
- # squint (26)
- # xtdb (5)
- # yamlscript (6)
I have a question about Malli integration. I have some simple examples working, but stumbled upon this:
(def Pkg [:map {:closed true}
[:Description :string]])
(defn fooz
"zii"
{:malli/schema [:=> [:cat Pkg] :string]}
[pkg]
(:Name pkg))
(comment
(fooz {:Name "hi"}))
I will see red squigglies in the buffer regarding a lack of :Description
at the call site, but I'm not warned about the illegal call to :Name
within fooz
. Malli itself warns about it in the repl at execution time, but that doesn't seem to propagate to the buffer squigglies.For extra context, the configuration have been generated using https://tonitalksdev.com/take-your-linting-game-to-the-next-level?showSharer=true
Might also be worth posting the config.edn
it spat out @U058DHAN3UP
{:linters {:unresolved-symbol {:exclude [(malli.core/=>)]},
:type-mismatch {:namespaces {packages {fooz {:arities {1 {:args [{:op :keys, :req {:Description :string}}],
:ret :string}}}}}}}}
Ah, seems like the fact it's a closed map isn't being reported so the fault may be #CLDK6MFMK after all
Cool, it's also smart enough to look inside of things
But it's only reporting the issue where it's actually a problem, namely the function call
There's nothing wrong with the let-binding itself.
Does Kondo understand closedness for Malli to even tell it about it?
Right, there's nothing to report because that symbol doesn't have any awareness until you try and use fooz
which flags a :type-mismatch
lint
If kondo does understand closedness, then this is a Malli bug. If it doesn't, this is a kondo feature request.
Will the scent of 🍖 attract him...?
It's 22:30 here though, I don't need an answer tonight 😆
@U04V15CAJ might 🙂
it's easy to find out using clj-kondo only, if you can make a repro without any downstream dependencies I'll have a look
The issue is that we're not sure how closedness of a Map is supposed to be communicated between the tooling (or if Kondo knows about the concept to begin with).
The repro is the code I posted further up ^^^
Ah ha! Is that a reasonable feature request to make? Shall I open a ticket?
What's expected behaviour here? Please and thanks.