Fork me on GitHub
#cljdoc
<
2021-09-27
>
martinklepsch16:09:12

There’s a few unreviewed PRs currently open. I’ll try to give them a review this week but if anyone else feels like helping out by reviewing some code, please check ’em out 🙂 https://github.com/cljdoc/cljdoc/pulls

lread16:09:29

I'm a bit distracted right now, but @deleted-user if you enjoy such activities and have time/interest, please do feel free to dive in!

lread16:09:37

Woot! We have another cljdoc dev team reviewer! 🎉

lread17:09:45

There's also a validator of sorts... but having it check url could be a separate piece of work. https://github.com/cljdoc/cljdoc/blob/master/script/verify-cljdoc-edn And we were thinking of making a new babashka version of this thing anyway... so probably best to think about it separately.

lread17:09:03

hmmm.... yeah.

lread17:09:44

Yeah, I was kind of working on something there but got distracted!

lread17:09:03

Are we visually showing an external url differently in our UI?

lread17:09:19

Do we need/want to?

lread17:09:36

The spec, if I remember correctly, might not be applied at analysis time... vague recentish memories... but something might be a bit non-obvious about when that user config cljdoc.edn spec is applied.

lread17:09:28

Ah so when being fetched from the db, not when analyzed to be put in the db?

lread17:09:02

Yeah... I think I was noticing that and that's why I was working on some validation for cljdoc.edn.

lread17:09:58

Oh I could be out to lunch, entirely possible. 🙂

lread17:09:17

Ha! There's only a few marbles rattling around in there!

lread17:09:00

Better make a note to myself on this one!

lread17:09:18

grasp is very cool but more for searching for code, no?

lread17:09:46

I was actually playing with malli for validating cljdoc.edn (outside of thinking about a bb script) but then switched to rewrite-clj because it seemed more straightforward to get good errors with line/col.

lread17:09:20

Hmm... clj-kondo already validates bb.edn and deps.edn I wonder if it could validate cljdoc.edn? I don't think its hooks support edn files.

borkdude17:09:52

We should add a hook for it

lread17:09:04

(are we just trolling borkdude with keywords to see how many times we can get his attention?)

😂 1
borkdude17:09:05

so you can do your own linting

lread17:09:13

Can clj-kondo hooks currently hook into .edn files?

borkdude17:09:29

no: we should add a hook for it

lread17:09:26

Gotcha. Maybe. Was thinking a custom hook hosted by cljdoc would make sense. Or would a hook for this in clj-kondo itself be of interest?

borkdude17:09:32

What I mean is: clj-kondo should support linting .edn files using a hook

borkdude17:09:50

so you can implement your own rules on it

lread18:09:21

Now I really get what you are getting at. Yep, that is what I was thinking as well.

borkdude18:09:38

Perhaps cljdoc can test drive this :)

lread18:09:45

Shall I raise an issue over at clj-kondo?

martinklepsch18:09:01

Would be nice to just have it in clj-kondo too though because that would mean you get automagic validation when you use clj-kondo

martinklepsch18:09:26

(vs. something that is external and people have to add manually)

borkdude18:09:44

for now I'd rather support the hook rather than having it built-in. you can get the hook via a dependency

borkdude18:09:16

it's more flexible growing this "outside" first

borkdude18:09:45

and it covers more use cases for more apps with their own .edn rules

lread18:09:33

Yeah @martinklepsch, clj-kondo supports hook export/import. Clj-kondo user will still have to opt in, but we can add instructions.

lread18:09:08

I suppose tooling that sits atop clj-kondo like clojure-lsp could choose to auto-opt-in... or make opt-in obvious/easy.

lread18:09:29

But that's a whole other topic.

lread18:09:50

This concludes our "how to summon borkdude" experiment. 🙂

borkdude18:09:26

just include the cljdoc-awesome-dev-tools deps in your REPL alias or so

borkdude18:09:32

and include your REPL alias in LSP

borkdude18:09:43

anyway, issue(s) welcome!

borkdude18:09:18

@lee yes. seems good. the code for linting bb.edn/deps.edn is at the bottom in impl/analyzer.clj

lread18:09:49

I vaguely remember dabbling about in there.

borkdude18:09:15

if you want to you whip up some prototype. I can imagine a :hooks {:file {...}} kind of thing where you have some filter on the filename or path and the hook receive the entire rewrite-edn node of the file + some other properties as a map

borkdude18:09:26

and you can do the same kind of things as in any other hook

borkdude18:09:50

and possibly transform the node as well by returning it, or just leave it by not returning it or returning the same one

borkdude18:09:46

possibly the file hook also wants to see the entire source string

borkdude18:09:02

so we can just add more stuff to the input map

lread18:09:38

Yeah sounds good. What about the hook checking if files referenced in edn exist? Would that be possible or would that be a security concern?

borkdude18:09:03

don't know :)

borkdude18:09:18

perhaps people should explicitly allow certain functions in hooks?

lread18:09:59

That's interesting yeah, by installing this hook, you are allowing it to ___.

borkdude19:09:20

what if you have a jar file though? this complicates the situation

borkdude19:09:26

I mean you can look around in the jar file etc

borkdude19:09:33

we can also just ignore all that for now

borkdude19:09:37

and see how far we get

borkdude19:09:17

perhaps people can add ;; cljdoc yes for realz in their file to enable the linting

simple_smile 1
lread19:09:17

But really, I'm supposed to be working on my GraalVM failure on Windows for rewrite-clj. I swear, I used to be a focused person!

borkdude19:09:28

in the case of .clj-kondo/config.edn the filename would be config.edn but .clj-kondo would make it pretty clear

borkdude19:09:59

ok, I won't distract you any further... hey wait, you started!

lread19:09:30

Yeah, exactly, I'm the problem! Or maybe it is not a problem.

borkdude19:09:33

we could make a safe function that lists the files from the current dir or so

borkdude19:09:53

you're a good problem to have my friend

lread19:09:26

Ah, very kind of you to say!

borkdude19:09:16

although you are with early retirement or so, it seems we keep you busy, haha

lread19:09:29

It is a win-win!