Fork me on GitHub
#clj-kondo
<
2023-01-18
>
Colin P. Hill13:01:42

In a deps project, is there any easy way to get clj-kondo to lint only the source paths? I can just list them manually, but it would be nice to be able to get that info from deps

borkdude13:01:16

clj-kondo doesn't support this, you have to do it manually

Colin P. Hill13:01:25

Dang. Okay, thanks. I'll ask in #C6QH853H8, maybe someone has a way to print out the computed :paths.

borkdude13:01:46

you can read this from deps.edn, right?

borkdude13:01:08

do you have such a high churn in source directories that you need to dynamically compute them?

borkdude13:01:14

(this is just a question, I'm not judging you ;))

Colin P. Hill13:01:12

It's more about being able to drop the configuration (or at least this bit of it) into a new project transparently. Also a bit of aesthetics – repeating it feels icky, computing it from a set of aliases feels tidy.

borkdude13:01:30

you can do this using a tiny bb script as well

Colin P. Hill13:01:18

Sure, or jet. Just feels like something someone else would have wanted to do before.

borkdude13:01:21

clojure -Spath | bb -e '(filter fs/directory? (str/split (slurp *in*) #":"))'

Colin P. Hill13:01:40

Ahh, slick, thanks

borkdude13:01:26

you may want to tweak it a bit, like this is probably better:

$ clojure -Spath | bb -e '(take-while fs/directory? (str/split (slurp *in*) (re-pattern fs/path-separator)))'
("src" "feature-xml" "feature-yaml" "feature-csv" "feature-transit")

Colin P. Hill13:01:26

Ah yeah. I'm on Windows, so that tweak is in fact necessary for me.

👍 2
borkdude13:01:21

Even more Windows friendly:

bb -e '(take-while fs/directory? (str/split (with-out-str (babashka.deps/clojure "-Spath")) (re-pattern fs/path-separator)))'

borkdude13:01:46

and you could combine this with the clj-kondo pod and combine this all into one script

Colin P. Hill13:01:47

Never actually occurred to me to use the pod, I should definitely change my bb task to do that.

Alan Birchenough17:01:19

I have a noob question related to my indirect use of clj-kondo via Calva. I am using Specter, and it defines handy special values like ALL . Specter docs recommend useing the library, but I don’t like to do that, so I require it :as spctr but also refer some useful values like ALL. However, when I :refer [ALL] I get a warning that says “Unresolved var: ALL”. Also all references to ALL throughout the source file are flagged in the same way. Aside from that, everything is working fine, so clearly the refer behavior found the ALL value and correctly referred it for use in the rest of the file. So how can I avoid these spurious warnings? Thanks for any insight.

borkdude17:01:19

When you include this config: https://github.com/redplanetlabs/specter#clj-kondo and then restart your project, everything will work

🙏 2
Alan Birchenough17:01:29

Oh, good catch. I missed that. Many thanks @U04V15CAJ!

👍 2