hey, I believe it was asked hundreds times here, but I'm still unable to find a solution - unresolved vars when linting a code with hugsql generated functions. in general all the calls like db/find-user-by-id
are ignored (as the documentation says) but only as long as I do not re-evaluate the db
namespace again (which auto re-generates functions). then, to get rid of clj-kondo warnings I need to clear the .clj-kondo/.cache and the linter is happy again. well... till next evalutation, which happens quite often as that's the way of refreshing hugsql functions after changes made in SQL queries.
is there anyway of making clj-kondo aware of the namespace evaluation and force it to clean its cache?
@michal you can ignore the vars in db
by adding it to {:linters {:unresolved-var {:exclude [db]}}}
I think you should not see unresolved vars in a hugsql namespace if there are no other user defined functions in the source though
the way I am using hugsql is to make special foo.db.hugsql
namespaces where only the vars from hugsql are defined and I call those from foo.db
awesome, namespace exclusion does its job. thanks!
warning: Unresolved var: async/<!!
I start getting this warning recently, probably because in clojure.core.async <!! is not a defn or macro anymore. it is defblockingop now - https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L125-L136
@delaguardo fixed: https://github.com/clj-kondo/clj-kondo/issues/1244
Not sure how to report, but a lint idea: https://gist.github.com/souenzzo/5620ef8587b5e9735808c113e01eab6d
this one is tricky because you might want to have deliberately two different implementations for the same dispatch value. For instance - in two separate namespaces
it isn't a anti-pattern? can be an "disabled by default" lint?
sure it can be disabled by default
I found it useful in combination with integrant and “multi-artifact project” (one source distributed as a multiple slightly differently configured jars)
Can clj-kondo update source file?
refactor-nrepl can do this. That specific functionality doesn't actually use much nrepl or tools.analyzer stuff iirc - I think it's more lightweight. I've been thinking of creating a "spin-off" of refactor-nrepl just for that - otherwise it's bit of a delicate dependency to ask people to have
Clj-kondo does not update your code. You might want to look at clojure-lsp for this.
It uses clj-kondo and then actions on its findings.
already logged, feel free to give feedback there: https://github.com/clj-kondo/clj-kondo/issues/1061
Feel free to post an issue. For now you can fix this in your config with :lint-as
clojure-lsp? seems a similar product of cider
it can do more than cider though in terms of rewriting your code. what kind of stuff would you like to "update"?
some unused imports
Hey @i, check https://clojure-lsp.github.io/clojure-lsp/features/ and https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/, if any questions you can ask on #lsp
Thanks.