cljdoc

https://cljdoc.org/ & https://github.com/cljdoc/cljdoc
Lance Campbell 2019-03-07T12:22:26.034700Z

Hi all. Just getting started with this project. I thought I would try to diagnose and fix a build failure. Looking at: https://circleci.com/gh/cljdoc/builder/2587

Lance Campbell 2019-03-07T12:23:41.035700Z

I have no idea how to begin to diagnose it. I read https://github.com/cljdoc/cljdoc/blob/master/doc/fixing-builds.md but I can't really figure out how to troubleshoot from that article.

Lance Campbell 2019-03-07T12:24:06.036200Z

Is diagnosing and fixing a build too advanced of a task for a cljdoc noob?

martinklepsch 2019-03-07T12:45:42.037300Z

Hi Lance, that page admittedly could use some work. Let's work through that build together and maybe we can update the docs afterwards

martinklepsch 2019-03-07T12:47:25.037800Z

@lkcampbell This might be useful in re-running the analysis locally https://github.com/cljdoc/cljdoc/blob/master/doc/running-cljdoc-locally.md

martinklepsch 2019-03-07T12:48:12.038300Z

./script/cljdoc ingest -p loco -v 0.3.1

martinklepsch 2019-03-07T12:51:21.039300Z

This reproduces the issue that is breaking the CircleCI job:

clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.Symbol, compiling:(loco/problem.clj:3:1)

martinklepsch 2019-03-07T12:53:23.040Z

Now in the loco git repo there's no problem.clj so we'll need to figure out where that file is coming from to actually look at the problematic code

martinklepsch 2019-03-07T12:58:21.041700Z

So there's problem.clj in the jar with the following contents:

(ns loco.problem)

(defrecord LocoProblem
  [variable-domains constraints optimize]
  ())

"x in [1,5]
y in [1,5]
z in {1,3,9}
(= (+ x y) 10)
(= (nth [x y z] 3) 50)
It seems that this might have been included during packaging but was never committed to Git. In this case there are two options: 1. We get the maintainer to cut a new release without the problematic file. 2. We hardcode a thing that will delete loco/problem.clj from the jar before analysis.

borkdude 2019-03-07T12:59:10.042800Z

Or make cljdoc more โ€œacceptingโ€ just skipping over the namespaces it couldnโ€™t parse?

๐Ÿ‘ 1
martinklepsch 2019-03-07T12:59:15.043Z

More generally this would also be solved by https://github.com/cljdoc/cljdoc/issues/228 (making the analysis fail more granularly, i.e. at the namespace level)

Lance Campbell 2019-03-07T13:31:28.043300Z

Yes, that's a good idea. I have set up a local server and it is working great. i have not yet rerun the analysis locally so I will try that.

Lance Campbell 2019-03-07T13:32:11.043500Z

Agreed. This is where I got stuck. I couldn't find problem.clj.

Lance Campbell 2019-03-07T13:35:48.043700Z

To clarify, when you say "in the jar", where is that jar being created? Is it an artifact produced by rerunning the analysis locally?

martinklepsch 2019-03-07T13:37:05.043900Z

the jar is downloaded from Clojars and then serves as the basis for the analysis

martinklepsch 2019-03-07T13:37:14.044100Z

You can see something like this:

ERROR Analysis with local AnalysisService failed
STDOUT -----------------------------------------------------
{:project "loco",
 :version "0.3.1",
 :jarpath "<https://repo.clojars.org/loco/loco/0.3.1/loco-0.3.1.jar>",
 :pompath "<https://repo.clojars.org/loco/loco/0.3.1/loco-0.3.1.pom>",
 :repos
 {"clojars" {:url "<https://repo.clojars.org/>"},
  "central" {:url "<http://central.maven.org/maven2/>"}}}

martinklepsch 2019-03-07T13:37:53.044300Z

After an initial run local jars (from ~/.m2/repository) may be used where you can also inspect them

martinklepsch 2019-03-07T13:38:05.044500Z

jar tf some.jar and unzip are your friends here

martinklepsch 2019-03-07T13:38:39.044700Z

ERROR Analysis with local AnalysisService failed
STDOUT -----------------------------------------------------
{:project "loco",
 :version "0.3.1",
 :jarpath "/Users/martinklepsch/.m2/repository/loco/loco/0.3.1/loco-0.3.1.jar",
 :pompath "/Users/martinklepsch/.m2/repository/loco/loco/0.3.1/loco-0.3.1.pom",
 :repos
 {"clojars" {:url "<https://repo.clojars.org/>"},
  "central" {:url "<http://central.maven.org/maven2/>"}}}
โ˜๏ธ second run

martinklepsch 2019-03-07T13:39:19.045Z

then

jar tf /Users/martinklepsch/.m2/repository/loco/loco/0.3.1/loco-0.3.1.jar
lists the contents

martinklepsch 2019-03-07T13:39:30.045200Z

and you can even use emacs to browse jars and open files inside them

Lance Campbell 2019-03-07T13:41:26.045400Z

Okay, thanks I will play around with this and see if I can recreate the troubleshooting experience you describe for myself

martinklepsch 2019-03-07T13:42:37.045600Z

๐Ÿ‘ let me know if something is confusing

martinklepsch 2019-03-07T13:43:03.045800Z

probably everything is a little confusing though hahahah ๐Ÿ˜„

martinklepsch 2019-03-07T13:43:06.046Z

good luck ๐Ÿ™‚

Marc O'Morain 2019-03-07T18:07:24.046400Z

cljdoc is so great โค๏ธ

4
Marc O'Morain 2019-03-07T18:07:52.047100Z

I just generated https://cljdoc.org/d/org.clojure/core.memoize/0.7.1/api/clojure.core.memoize rather than have to read docstrings on GH.

martinklepsch 2019-03-07T20:53:05.048100Z

@marc-omorain thanks for the kind words โค๏ธ ๐Ÿ™‚

martinklepsch 2019-03-07T20:53:32.048400Z

actually pretty decent docstrings as well ๐Ÿ‘

Marc O'Morain 2019-03-07T20:53:44.048800Z

And it works great on mobile!

martinklepsch 2019-03-07T20:54:39.049100Z

โ€” which obviously is the most important thing of all! ๐Ÿ˜„

martinklepsch 2019-03-07T20:55:07.049700Z

(I'm always joking about how mobile is something nobody ever asked for but I'm glad to see some people get something out of it ๐Ÿ™‚)

borkdude 2019-03-07T21:05:43.050300Z

reading docs on mobile is great when youโ€™re bored on the train or something ๐Ÿ˜‰