cljdoc

https://cljdoc.org/ & https://github.com/cljdoc/cljdoc
borkdude 2019-07-30T09:17:22.073700Z

maybe cljdoc can leverage this data somehow: https://github.com/borkdude/clj-kondo/tree/dump-analysis/analysis

lread 2019-07-30T12:20:31.082900Z

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.

borkdude 2019-07-30T12:24:59.083400Z

yeah, I'll add that to the next release

lread 2019-07-30T12:40:01.084200Z

that is exciting news!

borkdude 2019-07-30T14:55:24.084700Z

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

martinklepsch 2019-07-30T15:00:30.085900Z

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

borkdude 2019-07-30T15:01:13.086600Z

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

borkdude 2019-07-30T15:01:43.087100Z

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

lread 2019-07-30T17:07:22.088500Z

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

borkdude 2019-07-30T17:14:13.088700Z

yes

lread 2019-07-30T17:20:53.090400Z

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

borkdude 2019-07-30T17:21:29.090900Z

clj-kondo only statically analyzes the source code

borkdude 2019-07-30T17:21:54.091300Z

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

borkdude 2019-07-30T17:23:26.091700Z

import-vars magic is possible to analyze statically

lread 2019-07-30T17:26:02.093100Z

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

lread 2019-07-30T17:28:08.093300Z

codox does not make use of rewrite-clj

borkdude 2019-07-30T17:29:32.094100Z

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

lread 2019-07-30T17:30:08.094900Z

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

borkdude 2019-07-30T17:30:11.095Z

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

borkdude 2019-07-30T17:30:54.095500Z

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

lread 2019-07-30T17:32:14.096300Z

right… all variables in the equation.

borkdude 2019-07-30T17:33:40.096700Z

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

borkdude 2019-07-30T17:34:07.097300Z

i.e. it evals code

lread 2019-07-30T17:35:41.097600Z

yes

lread 2019-07-30T17:35:55.098Z

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

borkdude 2019-07-30T17:37:14.098400Z

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

borkdude 2019-07-30T17:37:34.099100Z

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

lread 2019-07-30T17:37:48.099300Z

excellent point sir

lread 2019-07-30T17:40:03.100300Z

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

borkdude 2019-07-30T17:40:56.100800Z

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

lread 2019-07-30T17:41:38.101200Z

yes

borkdude 2019-07-30T17:43:14.102900Z

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

lread 2019-07-30T17:43:14.103Z

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

lread 2019-07-30T17:43:20.103200Z

right

borkdude 2019-07-30T17:43:45.103700Z

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

borkdude 2019-07-30T17:44:27.104500Z

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

lread 2019-07-30T17:44:58.104800Z

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

lread 2019-07-30T17:45:08.105100Z

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

borkdude 2019-07-30T17:45:50.105500Z

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

borkdude 2019-07-30T17:45:54.105700Z

I gotta go now

lread 2019-07-30T17:46:29.106Z

later, thanks for chats @borkdude!