Wondering if anyone could give me an example of namespace local config for clj-kondo. I've tried:
(ns <http://some.name.space|some.name.space>
^{:clj-kondo/config '{:linters {:unresolved-symbol {:level :off}}}}
(:require ...))
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.
@ezmiller77 That's almost correct, you have to remove the ^
Ahhh
You can use the ^
but then your config needs to go before the namespace name
This is namespace metadata
And the ns form has special syntax for this: if you put the map after the name it will also work
🎇 That did it!
Thank you. I think this is my first time adding metadata to the ns form.
And thank you for the VERY fast response!
Is there a way to avoid an error exit code for warnings?
Or is this not encouraged?
@ezmiller77 This is the contract with regards to exit codes: https://github.com/clj-kondo/clj-kondo#exit-codes
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....
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.
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.Maybe @delaguardo knows the answer here.
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?