Hello! Is there something like a percentage count of annotation of a given lib
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)))
Perhaps it would be more common to want the coverage for all namespaces in a particular directory?
I'd think using all-ns would generate a bunch of noise.
Yeah, just noticed that this spits everything that is loaded hehe
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
Ooh, that’s exactly it
Thought that would be cool to put in open source projects, like that test coverage badge thingy, but for typing
I think I’ll try making it for deps, is it a good idea?
Sounds like fun, let me know what you come up with.
Let me know if that function still works.
Hmm, I couldn’t run it
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> I can’t find this uniquify.clj file also
you might need to bump your Clojure version.
I think update-vals was added in Clojure 1.11
the line is here: https://github.com/typedclojure/typedclojure/blob/4ac32d31d2491451035994335010585f9f054a9a/typed/cljc.analyzer/src/typed/cljc/analyzer/passes/uniquify.clj#L83
Oooh that’s right
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