Fork me on GitHub

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]}}}


awesome, namespace exclusion does its job. thanks!


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


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 -


Feel free to post an issue. For now you can fix this in your config with :lint-as


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)


already logged, feel free to give feedback there:


Can clj-kondo update source file?


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.


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


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