This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-20
Channels
- # aleph (1)
- # announcements (1)
- # aws (11)
- # babashka (117)
- # beginners (34)
- # calva (13)
- # cider (3)
- # clj-commons (8)
- # clj-kondo (24)
- # clj-yaml (36)
- # cljsrn (46)
- # clojure (50)
- # clojure-australia (5)
- # clojure-europe (239)
- # clojure-nl (3)
- # clojure-norway (3)
- # clojure-spec (16)
- # clojurescript (25)
- # core-typed (20)
- # cursive (41)
- # datahike (1)
- # datalevin (1)
- # datomic (17)
- # fulcro (27)
- # hyperfiddle (35)
- # introduce-yourself (1)
- # jobs (4)
- # lsp (20)
- # malli (8)
- # meander (8)
- # nbb (1)
- # off-topic (31)
- # parinfer (9)
- # pathom (3)
- # portal (2)
- # re-frame (20)
- # react (2)
- # reagent (8)
- # releases (1)
- # remote-jobs (4)
- # scittle (2)
- # shadow-cljs (8)
- # slack-help (4)
- # sql (30)
- # squint (3)
- # tools-deps (34)
- # xtdb (21)
Hi, this used to be a feature in lein-typed but I'm not sure if it works any more. Is that the kind of output you'd want? https://github.com/typedclojure/lein-typed#type-coverage
Ah, it might still work. try calling this function: https://github.com/typedclojure/typedclojure/blob/4ac32d31d2491451035994335010585f9f054a9a/typed/clj.runtime/src/clojure/core/typed.clj#L1397-L1405
Thought that would be cool to put in open source projects, like that test coverage badge thingy, but for typing
user> (c/var-coverage)
Syntax error compiling at (typed/cljc/analyzer/passes/uniquify.clj:82:15).
Unable to resolve symbol: update-vals in this context
user>
the line is here: https://github.com/typedclojure/typedclojure/blob/4ac32d31d2491451035994335010585f9f054a9a/typed/cljc.analyzer/src/typed/cljc/analyzer/passes/uniquify.clj#L83
Ah it works!
Registering annotations from typed.ann.clojure...
Registering annotations from typed.ann.clojure...
Found 0 annotated vars out of 1 vars
0% var annotation coverage
Trying to do it like this:
clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.11.1"} org.typedclojure/typed.clj.runtime {:mvn/version "1.0.32"} org.typedclojure/typed.clj.checker {:mvn/version "1.0.32"}}}' -X clojure.core.typed/var-coverage
But var-coverage expects the current namespace or a bunch of namespaces to run. Maybe making a cli version of it would suffice.
Something like:
(core/defn var-coverage
"Summarises annotated var coverage statistics to *out*
for namespaces nsyms, a collection of symbols or a symbol/namespace.
Defaults to the current namespace if no argument provided."
([] (var-coverage (all-ns)))
([nsyms-or-nsym]
(load-if-needed)
((requiring-resolve 'typed.clj.checker.statistics/var-coverage) nsyms-or-nsym)))