I joined just now to express my enormous appreciation for this library and how easy it's making my life. Thanks Michiel!
Has anyone gotten orchestra.core/defn-spec
to work? I've seen some chatter about it on here, and it seems like you should just be able to do the following:
{:lint-as {orchestra.core/defn-spec clj-kondo.lint-as/def-catch-call}}
But that didn't work. @jfntn, did you ever get this working?that config should work though
unless you are using a very old version of clj-kondo
I'm on clj-kondo v2021.02.13
I'll try
Much obliged, thank you
I'm on Spacemacs and I have the correct config AFAICT. It's still giving me "unresolved symbol."
@alex.joseph.whitt def-catch-all
, not def-catch-call
That was it! That'll teach me to copy-paste without double checking
@borkdude, is it still expected that references to the defn-spec'd function would show "Unresolved var" warnings? Or should that work too?
Let me try...
Looks like it works correctly here:
You will need to re-visit your other buffer though in order for the cache to pick up your new vars
with your new config
Might it make a difference that the var is in a local dependency lib through :local/root
?
Oddly it only shows up on one reference in the file, while other references to the same var don't complain
try clj-kondo --lint $(clojure -Spath) --parallel --no-warnings
that will lint your deps
and put the var info in your local cache
🙏
if you edit a local/root dep, that info doesn't end up in your project's cache, but in the other project's cache
Thank you!
So I would have to re-run that to pick up changes in the dep, then?
yes
Alright, understood. I'm glad this all works.
you can also just lint clj-kondo --lint ../../the-other-local-root/whatever
to update
if you want to sync
@borkdude when clj-kondo adds :defined-by
key to a var-definition
analysis bucket?
For a code like:
(defflow my-flow
....)
I want to know if the my-flow
is defined-by defflow
this already works with deftest
Not sure this is related with defflow
being a custom hook
for other macros lke defn
it doesn't add the defined-by
My issue: I implemented on clojure-lsp the :exclude-when-defined-by
on its custom linter https://clojure-lsp.github.io/clojure-lsp/settings/#unused-public-var, but it seems it doesn't work since clj-kondo don't send the defined-by
for other symbols than deftest
yeah, we can add that. issue + PR welcome
it's pretty much ad hoc I think
this is used by carve a lot to exclude "unused vars"
I see, do you think we would add defined-by
key to every var-definition?
what info do you actually want to have: - IF it was defined by something custom? - Or which thing it defined?
which thing it defined, so we could compare with the provided exclude setting from user
We already have that for deftest, I think is just make it work for other macros/functions ?
@borkdude I started to implement that, is there any way to get the namespace and the symbol of the var on https://github.com/clj-kondo/clj-kondo/blob/master/src/clj_kondo/impl/analyzer.clj#L427?
I only found call
https://github.com/clj-kondo/clj-kondo/blob/master/src/clj_kondo/impl/analyzer.clj#L433 that only have the symbol name, not the ns
can you post this as a comment on the github issue? I'm losing track of all threads here in Slack...
Sure!