Fork me on GitHub
#clj-kondo
<
2020-09-12
>
svt11:09:32

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

svt11:09:27

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??

borkdude11:09:55

@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

borkdude11:09:25

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

borkdude11:09:54

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

borkdude11:09:20

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

borkdude11:09:49

Hope that helps.

svt11:09:48

Thanks you @borkdude I’ll try these options

nivekuil12:09:58

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

borkdude12:09:54

@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

👍 3
borkdude13:09:43

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

borkdude13:09:57

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