maybe cljdoc can leverage this data somehow: https://github.com/borkdude/clj-kondo/tree/dump-analysis/analysis
I expect that cljdoc will eventually switch to using the most awesome clj-kondo. cljdoc currently uses a fork of codox to get data about clojure code. Codox uses clojure and cljs analyzers which means the lies told by such tools as import-vars are incorporated into the data story. I think we’d need https://github.com/borkdude/clj-kondo/issues/237 before switching over.
yeah, I'll add that to the next release
that is exciting news!
I'm sure there will be more data missing, so as a transition period you can combine data from clj-kondo and codox maybe
One thing to keep in mind with this stuff is that Codox expects the runtime and clj-kondo inspects the source code (as far as I understand). The latter approach will always have some problems with extracting information from libraries like amazonica
that's also what I thought. so maybe you could do something like a left join on codox data and enrich is with what clj-kondo found
how does codox do this for clojurescript, it evals stuff and then collects stuff?
to make sure I understand: are you guys talking about using clojure/cljs analyzers (codox) vs parsing source code (clj-kondo)?
yes
thanks, I made the assumption that clj-kondo would eventually use analyzers as well - to support import-vars magic
clj-kondo only statically analyzes the source code
I'm not sure what you mean by "analyzer"
import-vars magic is possible to analyze statically
so codox uses on cljs side: https://github.com/cljdoc/codox/blob/cljs-proper/codox/src/codox/reader/clojurescript.clj#L5 and on clj side: https://github.com/cljdoc/codox/blob/cljs-proper/codox/src/codox/reader/clojure.clj#L7
(ya, “analyzer” was wrong term for clj)
codox does not make use of rewrite-clj
I didn't assume that 🙂 it's clever to use clojurescript/analyzer, that had not even occurred to me 😛
It is an alternate approach to consider. It will tell you the truth (including lies).
but I guess that's also doing some kind of static analysis
it's an approach, but I don't know if that will work with GraalVM and how it will perform. also, it will only work for CLJS
right… all variables in the equation.
and the Clojure part does need the dependency loaded in the JVM I guess: https://github.com/cljdoc/codox/blob/cljs-proper/codox/src/codox/reader/clojure.clj#L29
i.e. it evals code
yes
I guess it is a bit of a different beast than clj-kondo
codox only uses tools.namespace to find all the namespaces and then loads them in a JVM: https://github.com/cljdoc/codox/blob/cljs-proper/codox/src/codox/reader/clojure.clj#L95
so if the code doesn't run, you won't find any data, which defeats the purpose of a linter
excellent point sir
so although clj-kondo might play a role in cljdoc, it won’t likely replace the features we are using from codox
you were bringing up the idea of breaking changes if you remove a var or an arity. this is the thing you could use clj-kondo for
yes
so you could do a "left join" on the vars you already have and then enrich that with the data from clj-kondo and keep that in a database per version
but there’s the question of import-vars on cljs … we might use data returned from codox for that.
right
and then compare a new version to an old version and report any breakage
but maybe you can already use codox for this, I don't know. it's just that clj-kondo already has this information, I'd be happy to share. but if you don't want to use clj-kondo for anything other than linting, that's ok too
I’ve fallen in love with clj-kondo, so I am biased
but we’ll try to use it where it makes sense
you can also display a namespace graph, or anything other fancy you come up with based on data 😛 https://github.com/borkdude/clj-kondo/tree/dump-analysis/analysis#namespace-graph
I gotta go now
later, thanks for chats @borkdude!