Fork me on GitHub

I’m parsing the output of clj-kondo to make a dashboard. One thing I’ve noticed is the message for unused binding and unresolved var are close but slightly different, missing a ::

warning: Unresolved var: Metric
warning: unused binding query
It would make it easier to parse if this was consistent and was Unused binding: query I think


or another way is if there was an argument that would have clj-kondo --lint --print-lint src and the output would be

src/metabase/util/urls.clj:22:20: warning: unresolved-var: Unresolved var: public-settings/site-url
and unresolved-var the linter is included in the output. Would make some dashboarding a bit easier to categorize how many errors of each type there are.


Why not use the JSON or EDN output?


And feel free to report the missing location issue with a repro


We could make linter messages more consistent. Feel free to make a separate issue for that


i was checking clj-kondo --help and didn't see those options for JSON or EDN


Those options are available under output in config, see

👍 1

Perhaps we should support those command line flags though


Issue welcome as well


i was able to work around it. I'll wait until we chat more in depth. was just trying to get a dashboard up with some metrics around all of our warnings


it came out pretty well. Have a dashboard in metabase about warnings in metabase 🙂


Awesome 👏

Michaël Salihi14:01:58

Hello, I get this error error: update-in with single key with this function for the second arity %2:

(defn update-vals [m v f]
  (reduce #(update-in % [%2] f) m v))


The message is saying that you could use (update % %2 f) instead.

Michaël Salihi14:01:42

Yes I understand that, but in my case I use only this function with multiple keys so I want to avoid any condition here. Thanks.


If others are reading: this not an error by default, but a warning, just to be clear. the linter is also optional (off by default). The way you write it above, update-in is always called with a single key, the %2 argument is the key, not multiple keys, no matter what the value of %2 is.


You can ignore any error with #_:clj-kondo/ignore but it doesn't make sense to ignore this, clj-kondo is correct in this case.


The %2 isn't spliced into your vector.

Michaël Salihi15:01:50

Yes understand, thanks @U04V15CAJ So to pass the CI tests for my current project, I have no choice to update my function and use condition against the argument to use either update or update-in, right?

Michaël Salihi15:01:44

> You can ignore any error with #_:clj-kondo/ignore but it doesn't make sense to ignore this, clj-kondo is correct in this case. Agree. I don't want to do that and affect all devs of the project just for this function 🙂


(update-in %1 [%2] ...) is the same as (update %1 %2 ...) always


no matter what the values of those arguments are


this is what clj-kondo is trying to say to you :)

Michaël Salihi15:01:23

Alright! 👍 Thanks to you and clj-kondo!


so yes, you should update your function, but no, you don't have to introduce conditions against the arguments

Michaël Salihi15:01:42

Yes perfect, I end up with this function:

(defn update-vals [m v f]
  (reduce #(update %1 %2 f) m v))
And thanks to clj-kondo, now it's clean.

🎉 1
Michaël Salihi14:01:25

Can we ignore this error only for this case? Without changing Kondo config file?

Noah Bogart14:01:04

What happens if you change % to %1?

Michaël Salihi14:01:26

Thanks for the suggestion. Same error.

Noah Bogart14:01:39

cool, sorry it didn’t help


Closed due to inactivity, but feel free to respond and I'll re-open


Just a message like "I'm still interested" suffices


Michiel, what about this (not mine) ticked? Is it OK that it is automatically closed?


Feel free to respond the same way


I'm thinking about making an automated test that would check if no namespaces outside of a particular package use namespaces inside that package. I'm looking at clj-kondo's :namespace-usage for this. Does it make sense to you? What about the performance? Note: I haven't used clj-kondo programatically yet, only (sporadically) as a command line tool and in Emacs


@jumar Yes, you can do this using the analysis data. Performance: just lint your own sources, should not take too long (depending on the size of your project of course...). If you lint all dependencies then it will take longer.


Perfect, thanks!


@U04V15CAJ This takes about 4 seconds on my project (30K lines of Clojure code, 300 files)

;; this can take about 4 seconds
  (time (def analysis (clj-kondo/run! {:lint ["src"]
                                       :config {:output {:analysis true}}})))
Would you say that's expected running time?


I would say so, are you disappointed? ;)


Not that much - I wish it was even faster but I think this is good enough for me right now 🙂


You can also use tools.namespace directly if you're only interested in namespace dependencies. That will be much faster since it only reads the top level ns form

👍 1