Fork me on GitHub
#clj-kondo
<
2023-01-02
>
Yehonathan Sharvit13:01:08

Is there a way to configure lein clj-kondo so that it exits with 0 when there are only warnings?

borkdude13:01:37

In general, you can configure this with --fail-level error

Yehonathan Sharvit13:01:34

Is there a way to set fail-level inside project.clj somehow?

borkdude13:01:55

@U0L91U7A8 I think you can do it like this: https://github.com/clj-kondo/lein-clj-kondo#config with :fail-level :error

borkdude13:01:23

I'm not entirely sure, I'll check

Yehonathan Sharvit13:01:33

And as part of .clj-kondo/config.edn ?

borkdude13:01:02

It's not part of the config.edn, but of the CLI invocation or library invocation.

borkdude13:01:13

You can of course use clj-kondo programmatically if that's easier for you

borkdude13:01:57

(-> (clj-kondo.core/run! {:fail-level :error :lint ["src" "test"]}) (clj-kondo.core/print!))

borkdude13:01:10

and then check the :errors yourself and throw

Yehonathan Sharvit13:01:41

I prefer to have it inside project.clj . But it doesn't seem to work 😞

borkdude13:01:56

did you try aliases like described in the README?

borkdude13:01:09

what clj-kondo version are you using

Yehonathan Sharvit13:01:39

With aliases, it works

Yehonathan Sharvit13:01:02

But not with ;config under :clj-kondo in project.clj

borkdude13:01:30

:fail-level isn't supposed to be inside :config

borkdude13:01:56

I think lein clj-kondo doesn't pick up on settings outside of config though so you'll have to go with aliases - is this a problem?

Yehonathan Sharvit14:01:12

It is a bit problematic in our case as we have a kondo-lint alias defined in a parent project. I'd prefer not overriding it in the child project.

borkdude14:01:42

Then use a different name?

borkdude15:01:14

@U0L91U7A8 Should be supported now with version 0.2.3

borkdude15:01:12

Use it like this:

{:config ... :fail-level :error}

borkdude15:01:54

sorry, something went wrong, it should be 0.2.4

Yehonathan Sharvit15:01:29

I cannot use a different name for kondo-lint alias because it is used by another alias 😱