Fork me on GitHub
#clj-kondo
<
2021-03-13
>
Ethan Miller17:03:07

Wondering if anyone could give me an example of namespace local config for clj-kondo. I've tried:

(ns 
  ^{:clj-kondo/config '{:linters {:unresolved-symbol {:level :off}}}}
  (:require ...))

Ethan Miller17:03:02

But I haven't been able to get it to work, and I've not been able to find an example of the syntax in the docs.

borkdude17:03:10

@ezmiller77 That's almost correct, you have to remove the ^

borkdude17:03:42

You can use the ^ but then your config needs to go before the namespace name

borkdude17:03:49

This is namespace metadata

borkdude17:03:04

And the ns form has special syntax for this: if you put the map after the name it will also work

Ethan Miller17:03:06

🎇 That did it!

Ethan Miller17:03:42

Thank you. I think this is my first time adding metadata to the ns form.

Ethan Miller17:03:57

And thank you for the VERY fast response!

Ethan Miller18:03:04

Is there a way to avoid an error exit code for warnings?

Ethan Miller18:03:11

Or is this not encouraged?

Ethan Miller23:03:11

Hmmm. I'm using clj-kondo in the context of github actions, which seem to fail on any exit code other than 0. I'm looking around to see if this is something I can configure....

delaguardo11:03:49

GH actions by default failed if exit code is not zero. You can wrap call to clj-kondo in a script which will catch exit code, analyze it and transform it to zero in case there's only warnings.

delaguardo12:03:56

echo '(def x (def x 1))' | clj-kondo --lint - || if [[ $? = 2 ]]; then exit 0; else exit $?; fi
this snippet pipes output of clj-kondo to simple if/else expression which is transforming exit code 2 (more than one warning found but no errors) to exit 0 indicating that this should be OK result in the scope of GH actions.

borkdude23:03:55

Maybe @delaguardo knows the answer here.

Ethan Miller23:03:20

Another question related to the unresolved-var linter. I'm getting some warnings about unresolved vars in a namespace. I thought the problem was that the namespace used :as instead of :refer but I switched it to refer an am still getting the warning. Any idea what might be happening?