Fork me on GitHub
#clojure-europe
<
2024-02-01
>
grav06:02:38

Hello and good morning!

schmalz08:02:12

Morning all.

dharrigan09:02:29

🤏 :facepunch:

maleghast09:02:39

madainn mhath :flag-scotland:

jasonbell09:02:15

Morning friends

👋 1
Ed10:02:22

Morning

reefersleep11:02:17

Good morning

reefersleep13:02:02

@borkdude I just tried applying carve to our frontend and was very excited to see thousands of lines of code removed. But then I reviewed the results, and there was lots of used component fns removed. Does clj-kondo/`carve` not "understand" hiccup "usage" of component fns?

reefersleep13:02:25

ie [my-component-fn arg1 arg2]

borkdude13:02:09

yes, it should understand such usages, similar to when you just write:

(defn foobar [])

foobar
it doesn't matter if the var is used from a vector or not, so hiccup seems irrelevant

reefersleep13:02:41

Further investigation is required 🙂

borkdude13:02:47

repro welcome

1
borkdude13:02:49

I tried to carve this file:

(ns scratch)

(defn foobar [])

;; foobar
it only reports foobar if I don't remove the ;;

borkdude13:02:19

and for this example, it only reports dude:

(ns scratch)

(defn foobar [])

(defn dude []
  [foobar])

reefersleep13:02:52

I used :aggressive true, btw

borkdude13:02:22

ah yes, in that case you need to define at least some entry-points because if you don't use any entry-point everything is unused by definition

reefersleep13:02:31

oohhhh my bad then!

reefersleep13:02:09

To be precise, my command was

clj -Tcarve carve! '{:paths ["src"] :interactive false :aggressive true}'

borkdude13:02:36

Try to add :ignore-vars [...] with a list if vars that are the starting point of your app

borkdude13:02:52

you can also use the interactive mode to add vars to the .carve/ignore file

reefersleep13:02:27

yeah 🙂 I'll experiment more.

borkdude13:02:04

> Sorry! No problem :)

reefersleep13:02:01

Hahaha ok ok ok, now only 835 lines were removed x)

reefersleep13:02:18

I mean, still something to be gained, and in particular by having automated the process!

reefersleep13:02:43

And this is only our /frontend project, there's a lot of other projects to try out 🙂

Eugen14:02:02

hello, any Clojure people going to FOSDEM this year? Would like to meet face to face for beer or beverage of choice 🙂 . Ping me here or via Mastodon: @[email protected]

yes 2