core-typed

kishima 2022-09-20T14:05:22.748549Z

Hello! Is there something like a percentage count of annotation of a given lib

kishima 2022-09-23T15:15:15.102589Z

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)))

2022-09-24T02:07:25.375509Z

Perhaps it would be more common to want the coverage for all namespaces in a particular directory?

2022-09-24T02:07:44.589519Z

I'd think using all-ns would generate a bunch of noise.

kishima 2022-09-24T02:27:31.633669Z

Yeah, just noticed that this spits everything that is loaded hehe

2022-09-20T18:31:14.676659Z

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

kishima 2022-09-20T18:54:47.666489Z

Ooh, that’s exactly it

kishima 2022-09-20T18:58:01.750939Z

Thought that would be cool to put in open source projects, like that test coverage badge thingy, but for typing

kishima 2022-09-20T18:59:38.706269Z

I think I’ll try making it for deps, is it a good idea?

2022-09-20T19:07:52.901229Z

Sounds like fun, let me know what you come up with.

2022-09-20T19:08:52.376399Z

Let me know if that function still works.

kishima 2022-09-20T21:23:01.685059Z

Hmm, I couldn’t run it

kishima 2022-09-20T21:23:05.051589Z

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> 

kishima 2022-09-20T21:23:19.105439Z

I can’t find this uniquify.clj file also

2022-09-20T21:41:57.804259Z

you might need to bump your Clojure version.

2022-09-20T21:42:46.390609Z

I think update-vals was added in Clojure 1.11

kishima 2022-09-20T21:54:22.836549Z

Oooh that’s right

kishima 2022-09-21T03:04:31.694289Z

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

🎉 1