Fork me on GitHub
#clj-kondo
<
2022-06-25
>
peterh11:06:21

Is it possible to exclude a var from :unexpected-recur similar to {:linters {:unresolved-var {:exclude [foo]}}}? I am trying to use the loopr macro which was recently introduced here by @p-himik (see https://clojurians.slack.com/archives/C8NUSGWG6/p1656081475345209 ), but I get an “Unexpected usage of recur” warning from clj-kondo since it is not in tail position. I tried :unexpected-recur {:exclude [(dom-top.core/loopr)]}, but it does not seem to work.

borkdude11:06:49

@peterhfmnn A better solution might be to use {:lint-as {custom.ns/loop clojure.core/loop}}

👀 1
peterh12:06:10

This gets rid of the “Unexpected usage” error, but unfortunately not the “Recur can only be used in tail position” error, since there is a final form underneath the recur call. Maybe I have to build a custom hook?

borkdude12:06:03

There is also :config-in-call where you can define a complete new configuration and disable this linter

borkdude12:06:36

:config-in-call {custom.ns/loop {:linters {:unexpected-recur {:level :off}}}}

borkdude12:06:04

But yeah, a hook would be the optimal solution I guess

borkdude12:06:25

If you only use this function sporadically, you can also use #_:clj-kondo/ignore before the warning

peterh12:06:32

:config-in-call seems to work fine, thanks! Is it missing from the documentation?

borkdude12:06:15

I think so, since I included it as an experimental thing, but I guess we could document it now :)

clojure-spin 1
peterh12:06:30

If I use it more often, I may write a custom hook. I did that before and it wasn’t too difficult.

👍 1