Fork me on GitHub
#cljdoc
<
2019-07-30
>
lread12:07:31

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.

borkdude12:07:59

yeah, I'll add that to the next release

lread12:07:01

that is exciting news!

borkdude14:07:24

I'm sure there will be more data missing, so as a transition period you can combine data from clj-kondo and codox maybe

martinklepsch15:07:30

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

borkdude15:07:13

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

borkdude15:07:43

how does codox do this for clojurescript, it evals stuff and then collects stuff?

lread17:07:22

to make sure I understand: are you guys talking about using clojure/cljs analyzers (codox) vs parsing source code (clj-kondo)?

lread17:07:53

thanks, I made the assumption that clj-kondo would eventually use analyzers as well - to support import-vars magic

borkdude17:07:29

clj-kondo only statically analyzes the source code

borkdude17:07:54

I'm not sure what you mean by "analyzer"

borkdude17:07:26

import-vars magic is possible to analyze statically

lread17:07:02

(ya, “analyzer” was wrong term for clj)

lread17:07:08

codox does not make use of rewrite-clj

borkdude17:07:32

I didn't assume that 🙂 it's clever to use clojurescript/analyzer, that had not even occurred to me 😛

lread17:07:08

It is an alternate approach to consider. It will tell you the truth (including lies).

borkdude17:07:11

but I guess that's also doing some kind of static analysis

borkdude17:07:54

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

lread17:07:14

right… all variables in the equation.

borkdude17:07:40

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

borkdude17:07:07

i.e. it evals code

lread17:07:55

I guess it is a bit of a different beast than clj-kondo

borkdude17:07:14

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

borkdude17:07:34

so if the code doesn't run, you won't find any data, which defeats the purpose of a linter

lread17:07:48

excellent point sir

lread17:07:03

so although clj-kondo might play a role in cljdoc, it won’t likely replace the features we are using from codox

borkdude17:07:56

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

borkdude17:07:14

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

lread17:07:14

but there’s the question of import-vars on cljs … we might use data returned from codox for that.

borkdude17:07:45

and then compare a new version to an old version and report any breakage

borkdude17:07:27

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

lread17:07:58

I’ve fallen in love with clj-kondo, so I am biased

lread17:07:08

but we’ll try to use it where it makes sense

borkdude17:07:50

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

borkdude17:07:54

I gotta go now

lread17:07:29

later, thanks for chats @borkdude!