Fork me on GitHub
#clj-kondo
<
2022-08-03
>
NickName15:08:27

I wonder what might be causing it. I don’t have any other format in the namespace. I also tried to delete .clj-kondo/.cache but the error still persists.

borkdude15:08:25

@islambeg format isn't available in .cljs

🙌 1
NickName15:08:33

Oh didn’t know that, thanks!

borkdude15:08:31

🎉 4
2
Dumch18:08:59

Hey! I am trying to write a little stack based DSL and set up clj-kondo to check the syntax. May be someone did something like this? Two questions. 1. Is it a good idea in general to use clj-kondo for this? 2. I don't know how to parse syntax inside a hook. As I get it, there is no way to use core.spec or instaparse here. And I can't even require a clj-kondo.hooks-api/prewalk (but it seems to be in the https://github.com/clj-kondo/clj-kondo/blob/master/src/clj_kondo/hooks_api.clj):

WARNING: error while trying to read hook for dumch.concatenative/defstackfn: prewalk does not exist

borkdude18:08:52

@arturdumchev In the hook environment you have clojure.walk/prewalk

👍 1
Stefan T19:08:35

When linting a directory, is it possible to globally exclude certain patterns? In my case I'm seeing that kondo spends a lot of time node_modules and some other directories with many files that I'd like to have kondo skip all together.

borkdude19:08:29

@stefan.toubia I recommend not including node_modules in the --lint arguments

borkdude19:08:52

If you're doing --lint . then change it into --lint src test whatever

Stefan T19:08:28

In my case I'd like to lint a directory containing dozens of projects all in one go. This directory contains more than just Clojure projects though.

Stefan T19:08:46

Basically I'm trying to lint the entire monorepo

borkdude19:08:39

@stefan.toubia Maybe a little bit of scripting is more appropriate here then. E.g. recurse through all repos and extract all source dirs or all .clj files and then pass that

borkdude19:08:55

You can call clj-kondo from #babashka as well

borkdude19:08:42

It's also recommended to call clj-kondo from within each project and not from a global parent directory. You can also do this with scripting

Stefan T19:08:50

Yeah OK maybe I'll give that a try, thanks. I agree that exclusion patterns are kind of a pain to deal with. Ignoring node_modules is a regular problem for most tools though (damn you Node!)

borkdude19:08:54

Haha, Node is the reason I moved all my code out of Dropbox (I used that as an extra safeguard before committing)

🥲 1
Stefan T19:08:45

Is kondo currently able to read deps.edn to find the class paths that should be linted?

borkdude19:08:34

you can feed clj-kondo a classpath with $(clojure -Spath)

Stefan T19:08:18

Ah of course. Well then I guess I'm already set, our monorepo has an aggregated deps.edn in the repo root with all projects paths listed. Thanks again for your help!

borkdude19:08:27

Note that this path will also include all dependencies

Stefan T19:08:34

Ah yes, this is true. Are there valid use cases for linting dependencies, does kondo need to do this to maybe lint macros from those dependencies? I'm back to wondering if a global exclude makes sense, in my case I could exclude .m2 and node_modules directories.

borkdude19:08:35

You can lint your src folders without linting dependencies first, this works fine, but will give you less accurate analysis

borkdude19:08:13

E.g. if you're interested in finding that your code calls foo.bar/baz with the wrong amount of arguments, you need to analyze foo.bar first

Stefan T19:08:27

Ah ok thanks that makes sense.