This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-25
Channels
- # announcements (4)
- # babashka (3)
- # beginners (79)
- # biff (4)
- # calva (17)
- # cider (18)
- # clj-kondo (21)
- # cljdoc (45)
- # cljs-dev (14)
- # cljsrn (9)
- # clojure (90)
- # clojure-europe (86)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-portugal (1)
- # clojure-uk (9)
- # clojurescript (20)
- # code-reviews (23)
- # conjure (14)
- # cursive (12)
- # datascript (12)
- # emacs (5)
- # events (2)
- # fulcro (13)
- # gratitude (1)
- # holy-lambda (9)
- # lambdaisland (2)
- # malli (6)
- # nbb (1)
- # nextjournal (2)
- # nrepl (30)
- # off-topic (63)
- # pathom (1)
- # portal (24)
- # reagent (5)
- # reitit (13)
- # releases (2)
- # remote-jobs (1)
- # sci (90)
- # shadow-cljs (49)
- # spacemacs (5)
- # sql (13)
- # testing (20)
- # tools-build (17)
- # xtdb (27)
On the topic of writing clj-kondo hooks (ie analyze-call), the debugging instructions in hooks.md
suggests using prn statements.
So the idea is that if I were to manually run clj-kondo
from the cli - to lint some file that I know makes use of the macro I'm writing the hook for - I should see those prn statements in the command line alongside whatever linting results for the file (`eg linting took 57ms, errors: 1, warnings: 5`), right?
If so, I do not see the print statements - how can I debug if I config'd it incorrectly?
I wasn't able to get it to work either, so I was just throwing errors to see the data 🙂 Subscribing to the thread.
If you don't see any output then simplify your example until you do see output and then go from there.
And previously I did evertything without terminal, used to see results only in diagnostics
I've written something here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#debugging But it may not be obvious that testing from the terminal is what is implied here

I also spent like half an hour trying to debug it with repl and googling for help, then surrendered
I wasn't sure at all myself what was implied - I know for sure that there are many non standard workflows in the clojure/lisp/repl world thus I do not know what I do not know, and in this case, it is not so obvious if the answer to my question was either: 1. I made a mistake in the execution of my work/code within my hook, so I'll simplify my hook until it prints and then go from there 2. OR I made a mistake in my understanding of the workflow itself, or messed up config or namespacing or something I'm still new to, so no amount of simplifying my hook would help, as the issue was somewhere else unknown to me
@U037TPXKBGS, I just checked out the new https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md#developing-hooks-in-the-repl and it is amazing. I end up adding an alias in my deps.edn:
:clj-kondo
{:extra-deps {clj-kondo/clj-kondo {:mvn/version "LATEST"}}}
And run a repl like:
clj -M:nrepl:clj-kondo
Don't know if it's a bug or I do not know somehting. One (1) way linter works with nvim-lsp-config and command line, another (2) it works only in command line. 1. I get node directly from children and then pass it to let body. 2. I get node from children, do sexp on it, then convert it back to node (result is the same in print). here is a screen for 1:
My function looks like:
...
(prn :key2 key2) ;=> :key <token: bob>
(prn :key (token-node key)) ;=> :key <token: bob>
...
{:node <here a let form like:
(let [name1 value1 ... name-n value-n]
key2 ;; key2 works, (token-node key) does't work
body-node)>}
by 'working in command line" I mean it prints error as expected for both key2
and (token-node key)
varians
If it works on the command line then it's likely that your editor doesn't use the same version of clj-kondo
We probably found the issue, hook is missing meta data: https://clojurians.slack.com/archives/C03A6GE8D32/p1650914391109129?thread_ts=1650669838.842329&cid=C03A6GE8D32