Fork me on GitHub
#clj-kondo
<
2022-12-11
>
lilactown19:12:30

can I configure clj-kondo to ignore all warnings inside of a specific macro?

lilactown19:12:07

e.g.

(my-special-macro foo bar baz)
I just want clj-kondo to ignore all forms inside my-special-macro for now

borkdude19:12:10

@U4YGF4NGM not all warnings, but you can tweak specific linters within a macro

borkdude19:12:53

Try:

{:config-in-call {your/macro {:linters {:unresolved-symbol ...}}}
etc

lilactown19:12:48

that might work. I'm trying to figure out how to disable the linter for

error: a number is not a function

borkdude19:12:57

then you can see the keyword in the message

lilactown19:12:31

ah great! 😄

lilactown19:12:20

{:config-in-call
 {town.lilac.mogget/eval
  {:linters {:unresolved-symbol {:level :off}
             :invalid-arity {:level :off}
             :private-call {:level :off}
             :not-a-function {:level :off}}}}}
works great 🙂 thank you for the help!

👍 1
borkdude19:12:21

Is this about an eval macro that gets an unquoted expression?

lilactown19:12:11

I'm writing a little interpreter for a Factor-like language, that uses EDN

borkdude19:12:37

why not use a quoted expression (even if it's a macro)?

borkdude19:12:08

clj-kondo will soon get support for linting inside quoted expressions (so navigation, etc work, but all warnings disabled)

lilactown19:12:40

I didn't really think too hard about it

lilactown19:12:05

it just seemed nice to be able to type

(eval 1 (inc) (inc) bi) ;; => [2 2]
without an extra set of parens & a quote

borkdude19:12:24

you could also write a hook for this which expands into a quoted form and a vector carrying the expressions ;)

borkdude19:12:41

anyway, doesn't really matter

lilactown19:12:22

yeah, I might write my own custom hook for it later if I get really in the weeds. just wanted a quick way to turn it off so I could find the actual bugs in my code 😛

🙂 1
lilactown19:12:13

here's day 1 of AoC in my little language 😄

"1000
2000
3000

4000

5000
6000

7000
8000
9000

10000"

#"\n" str/split
(parse-long) map
(nil?) partition-with
(0 (+) reduce) map

;; part 1
(0 (max) reduce)

;; part 2
(sort reverse 3 take 0 (+) reduce)
bi

borkdude19:12:05

it's a stack based language or so?

lilactown19:12:16

that's right

lilactown19:12:50

I was doing AoC in https://factorcode.org and got inspired to make one myself