Fork me on GitHub
#clj-kondo
<
2022-04-11
>
Noah Bogart18:04:13

hey michiel, have you thought at all about adding "auto-correct" to clj-kondo?

Noah Bogart18:04:59

i follow the rubocop releases and they flag certain lints as being able to auto-correct issues, and then also flag certain auto-correctable lints as "unsafe" (potentially changing meaning), and then i spent the weekend thinking about how exactly that might be done with clj-kondo lol

borkdude19:04:15

clj-kondo does not auto-correct issues, but it does give precise locations and information so other tools can be built on top which do so, e.g. clojure-lsp has a ton of stuff

borkdude19:04:59

this way I can focus on the linting + analysis and don't spend a ton of time on "hey, it doesn't auto-correct correctly, my build is broken" issues

borkdude19:04:50

another such tool is https://github.com/oxalorg/clj-konmari/ for example

💚 1
borkdude19:04:06

Congrats on your first PR in clj-kondo btw, just merged :)

Noah Bogart19:04:21

thank you! so glad and excited to contribute, which is one of the reasons i've been thinking about this stuff

ericdallo19:04:03

Congrats for the contribution too :) I saw the PR and I always wondered, what is the recommended way? Does clojure style guide mentions that anywhere? I personally prefer not using keywords but I know clj-kondo itself uses a lot that, so not sure it's just a personal preference

Noah Bogart19:04:24

alex miller said that it was originally allowed to handle namespaced keywords but once they got that working with ::keys , it's not the preferred method by the core team, which is good enough for me! i don't think the style guide says anything about it one way or the other

👍 1
borkdude19:04:06

I'm fine with abandoning that style forever, now that I'm not working together anymore with someone who did that all over the code base. It's something I got infected by :)

👍 1
ericdallo20:04:04

Nice, good to know

didibus22:04:03

I didn't even know :keys [:a :b] worked. I could swear the spec for defn doesn't allow it/

didibus22:04:21

Wow, it does work, and I hate it haha

😂 1
borkdude19:04:05

I actually don't use a lot of "auto-correct" stuff myself, usually do it manually

👍 1
🙌 1
borkdude19:04:37

except maybe renaming a local or so, that's where clojure-lsp really comes in handy

ericdallo19:04:17

You should try "add missing require" code actions @borkdude is the one I most use for sure :)

☝️ 2
Noah Bogart19:04:15

that one is great, I use it multiple times a day. love to type out (str/join ", ") and then have it added automatically

ericdallo20:04:23

yes, I love more how we can discover and suggest known aliases from ns never required :)