Fork me on GitHub
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


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


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


another such tool is for example

💚 1

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


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

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

Nice, good to know


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


Wow, it does work, and I hate it haha

😂 1

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

👍 1
🙌 1

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


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


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