clj-kondo

https://github.com/clj-kondo/clj-kondo
svt 2020-09-12T11:22:32.146700Z

I there any way to fix the errors given by clj-kondo via command??

svt 2020-09-12T11:24:27.148800Z

I’m working on a project and previously it didn’t had clj-kondo and after adding clj-kondo we found 300+ issues with code. Fixing all of them manually will be pain and time consuming. Is there any other way you can suggest??

borkdude 2020-09-12T11:29:55.149300Z

@cksharma122 There are several ways to deal with this. I think the easiest one is spitting out the warnings to a file and then diff with that file the next time

borkdude 2020-09-12T11:30:25.149800Z

And there are plenty of ways to configure clj-kondo, if you want to disable some rules for now: https://github.com/borkdude/clj-kondo/blob/master/doc/config.md

borkdude 2020-09-12T11:30:54.150300Z

Reviewdog is one of the tools that can do this diffing as well: https://github.com/reviewdog/reviewdog but I've never used it.

borkdude 2020-09-12T11:31:20.151Z

Another way is using EDN output and then do some scripting on top of that (possibly using babashka)

borkdude 2020-09-12T11:31:49.151200Z

Hope that helps.

svt 2020-09-12T11:33:48.151700Z

Thanks you @borkdude I’ll try these options

nivekuil 2020-09-12T12:53:58.151800Z

does it make sense to have a lint for get-in used only to extract keywords/functions? It seems like it's just strictly better to use -> for those, being faster and less syntactically noisy

borkdude 2020-09-12T12:56:54.153Z

@kevin842 Feel free to post an issue about this so people can discuss. I think an opt-in linter could work. Also, I think you can write a thing like this yourself now using hooks. Example: https://github.com/borkdude/clj-kondo/issues/323#issuecomment-691247062

👍 1
borkdude 2020-09-12T13:01:43.154300Z

We already have a related linter, single-key-in, which warns if you use get-in and assoc-in and update-in with a vector with a single key in it

borkdude 2020-09-12T13:04:57.154800Z

I guess you would then get two warnings about (get-in x [:foo]) - hmm, no, it only should suggest -> when you have more than one key