clj-kondo

https://github.com/clj-kondo/clj-kondo
Cnly 2020-08-04T07:29:02.277300Z

@borkdude Hi! I’m working on the integration of clj-kondo and clojure-lsp. I know that if I pass a directory to kondo then it’ll be able to see usages, etc. between files. But for LSP’s use case, I actually need kondo to lint the file that the user is currently editing (i.e. not on disk yet) together with those already written to disk. What will be a recommended way of doing that?

borkdude 2020-08-04T07:30:28.277800Z

@cnly clj-kondo.core/run! accepts :lint which is a seq of paths

borkdude 2020-08-04T07:30:57.278300Z

a path can be a single file or a directory, in which case all files in the directory will be linted (recursively)

Cnly 2020-08-04T07:32:32.280100Z

If I pass e.g. ["src" "-"] to run! where I feed the current file in memory through stdin, kondo will see the on-disk version and the in-memory version of the current file at the same time.

borkdude 2020-08-04T07:32:57.280600Z

True. Why do you want to lint them all at once btw?

borkdude 2020-08-04T07:33:53.281400Z

The way it normally works is that the user edits a file, clj-kondo lints it and saves information to .clj-kondo/cache. Along the way it builds up more and more information about the linted files in the cache.

Cnly 2020-08-04T07:34:40.282100Z

So you mean, we only need to lint the whole directory once, and then as the user edits a file, we just feed that single file to kondo, right?

borkdude 2020-08-04T07:35:29.282600Z

yes

Cnly 2020-08-04T07:35:36.282800Z

And information about references between files will still be remembered and used?

borkdude 2020-08-04T07:35:43.283100Z

yes

Cnly 2020-08-04T07:35:54.283400Z

Oh, cool. Let me try that. Thanks!

nivekuil 2020-08-04T18:07:20.285400Z

hi, not sure if this is in scope as a bug but core.async/go-loop appears to have a false positive; the first arg is for binding but I get an unresolved symbol x e.g.`(go-loop [x 1] x)`

borkdude 2020-08-04T20:01:20.286Z

@kevin842 Full repro please. Here it works fine.

nivekuil 2020-08-04T20:06:24.286400Z

yeah, you're right, the false positive is with me :) I had replaced clojure.core.async with just core.async somehow.

borkdude 2020-08-04T20:11:13.286600Z

ok, no problem