clj-kondo

https://github.com/clj-kondo/clj-kondo
michal 2021-04-01T07:57:17.154200Z

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.

michal 2021-04-01T07:57:51.155Z

is there anyway of making clj-kondo aware of the namespace evaluation and force it to clean its cache?

borkdude 2021-04-01T08:32:08.155800Z

@michal you can ignore the vars in db by adding it to {:linters {:unresolved-var {:exclude [db]}}}

borkdude 2021-04-01T08:32:39.156300Z

I think you should not see unresolved vars in a hugsql namespace if there are no other user defined functions in the source though

borkdude 2021-04-01T08:33:06.156900Z

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

michal 2021-04-01T09:03:16.157Z

awesome, namespace exclusion does its job. thanks!

2021-04-01T13:28:28.158900Z

warning: Unresolved var: async/&lt;!! 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

borkdude 2021-04-02T09:18:00.163500Z

@delaguardo fixed: https://github.com/clj-kondo/clj-kondo/issues/1244

souenzzo 2021-04-01T13:35:18.159700Z

Not sure how to report, but a lint idea: https://gist.github.com/souenzzo/5620ef8587b5e9735808c113e01eab6d

2021-04-01T13:41:55.159800Z

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

souenzzo 2021-04-01T13:44:37.160Z

it isn't a anti-pattern? can be an "disabled by default" lint?

2021-04-01T13:46:49.160200Z

sure it can be disabled by default

2021-04-01T13:48:06.160400Z

I found it useful in combination with integrant and “multi-artifact project” (one source distributed as a multiple slightly differently configured jars)

2021-04-01T14:21:33.161Z

Can clj-kondo update source file?

vemv 2021-04-02T20:23:43.168200Z

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

borkdude 2021-04-01T14:41:35.161100Z

Clj-kondo does not update your code. You might want to look at clojure-lsp for this.

borkdude 2021-04-01T14:41:46.161300Z

It uses clj-kondo and then actions on its findings.

borkdude 2021-04-01T14:42:34.161500Z

already logged, feel free to give feedback there: https://github.com/clj-kondo/clj-kondo/issues/1061

borkdude 2021-04-01T14:43:08.161900Z

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

2021-04-01T14:55:05.162100Z

clojure-lsp? seems a similar product of cider

borkdude 2021-04-01T14:56:34.162300Z

it can do more than cider though in terms of rewriting your code. what kind of stuff would you like to "update"?

2021-04-01T15:06:43.162600Z

some unused imports

borkdude 2021-04-01T15:11:03.162800Z

@ericdallo

ericdallo 2021-04-01T15:13:17.163Z

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

2021-04-01T15:14:57.163300Z

Thanks.