Fork me on GitHub
#re-frame
<
2021-09-03
>
borkdude07:09:47

using clojure-lsp you can see the amount of references using lens-mode. also you could leverage the clj-kondo analysis directly and find mismatches yourself using some programming. https://github.com/clj-kondo/clj-kondo/blob/master/analysis/README.md

Oliver George23:09:00

Thanks for the tips. Just testing my understanding here. Perahps I'm missing something. Kondo analysis with the keywords flag shows me all keyword registrations. That's good fodder for checking dispatches will find a registration. Kondo hooks don't have access to the full analysis data. (If they did I could use it to check dispatch calls reference registered keywords). Kondo doesn't has a reg equivalent of var-usages. (if it did I could use the analysis data directly to patch up reg-usage against [:keyword :reg] data. Kondo hooks can't contribute additional analysis data which would be included in the output. (if it did my dispatch hook could note registered keyword use) So a kondo only approach might be two parse: 1. generate analysis data, 2. run again with a hook which uses analysis data.

borkdude08:09:26

Yeah, this isn't very well supported with hooks right now. I think you could implement it as a JVM program which you invoke on the analysis data every so often, to find mismatches

👍 2
borkdude08:09:09

but perhaps we can implement this in clj-kondo as a built-in this as well

borkdude08:09:27

hmm, but lsp already shows 0 usages I think?

borkdude08:09:33

if you reg something?

borkdude08:09:00

so perhaps this is something that could be enhanced in clojure-lsp

Oliver George10:09:28

I've not looked at how clojure-lsp works before. Presumably feeds off kondo analysis data and can generate it's own warnings/errors based on your suggestion. I'll poke around.

borkdude10:09:47

yeah. I assumed you were using clojure-lsp already

Oliver George07:09:27

I had fun trying out kondo hooks today.

Oliver George07:09:44

Thank you for hooks and thank you for that link. I’ll have a play and see what I can do.

Oliver George07:09:54

Does it make sense to use a hook and refer to the analysis cache :reg data?