Fork me on GitHub
#clj-kondo
<
2022-04-14
>
Teemu Kaukoranta08:04:22

Hello! Is there a way to print the final configuration that clj-kondo uses? Or is there a sample config.edn somewhere with all the default values?

borkdude08:04:11

This default is in clj-kondo’s repo in impl/config.clj. Also see linters.md for all linters + defaults.

Teemu Kaukoranta08:04:30

Excellent, thank you.

Noah Bogart13:04:28

Has any thought been given to separating "parsing the code to an AST" and "linting the code"? I noticed that they're intertwined currently.

Noah Bogart13:04:25

i would be willing to help out if this is desirable

borkdude13:04:57

It's intertwined for performance, everything can be done in a single pass

Noah Bogart13:04:08

i had a feeling that was the case. have you experimented at all with separating them into two passes? Does that degrade performance by a lot?

borkdude13:04:36

The rewrite-clj stuff is already the AST

borkdude13:04:02

when I initially wrote clj-kondo I had multiple passes and discoverered that a single pass was much better for fast responses

👍 1
Noah Bogart13:04:28

yes but you have done a lot of good work adding relevant data to the naive ast

borkdude13:04:46

I would rather not refactor for "beauty" but to solve a real problem

👍 1
borkdude13:04:16

many linters still need the raw rewrite-clj nodes

borkdude13:04:30

if you are looking for stuff to help with, take a look at the project: https://github.com/clj-kondo/clj-kondo/projects/1

Noah Bogart13:04:00

I was more thinking about ways to make lints standalone: an object or function that can be registered as working on some ast form, so that if i wanted to write a new lint, I wouldn't have to dig through the code to find the one spot where clj-kondo handles that ast, i could just say something like:

(reg-linter! {:ast-nodes [clojure.core/cond] :name :even-forms :lint-fn (fn [ctx bv] (odd? (count (:children bv)))})
or something similar

Noah Bogart13:04:34

oh cool, i haven't seen that project page. i'll take a look, see if there's anything i can help with

Noah Bogart13:04:26

my thought with bringing all of this up is that if the barrier for entry is lower, more people might contribute new lints (like I did recently), which I think is a net good overall

lread16:04:59

I continue to have major ❤️ for clj-kondo. I just upgraded to the newest version and a new linter said, “Hey, buddy, this looks a little off, maybe?”

src/rewrite_clj/reader.cljc:242:11: warning: Prefer placing return type hint on arg vector: Closeable
linting took 4710ms, errors: 0, warnings: 1

❤️ 6
lread15:04:27

Gotta love it when your own tools help you out! So cool!