hi, is it possible to somehow exclude unused namespace/unused referred var warnings just for a certain namespace , we use mount and have a core ns that refers to a few to ensure they load , so would like to exclude these warnings just in that ns
@d5p How exactly are you requiring those namespaces? What exact syntax are you using?
I think that if you (:require [some.namespace])
like that rather than (:require some.namespace)
that clj-kondo won't warn about it being otherwise unused?
i’m requiring them like
(ns taskmanager.core
(:require [taskmanager.batch.alerts :refer [task-alert-consumer]]
[taskmanager.batch.batch :refer [batch-task-consumer incoming-batch-task-consumer]]
[taskmanager.config :refer [project config]]
[taskmanager.http :refer [http-server]]
[taskmanager.db :refer [*db*]]
[taskmanager.redis-client :refer [*redis-client*]]
[taskmanager.queue :refer [sqs-buffered-client]])
(:gen-class))
and it reports all of them as unused
Because you're not using any of the referred symbols?
yeh, they’re just required in this ns to ensure mount can start them
Take the :refer
's out.
if you're not using the symbols that is why you're getting warnings.
ha , was hoping it would be something dumb and easy, and can’t get easier than that! been explicitly referring the states for years and never really thought about it, thanks!
In hooks, what is the rationale for dealing with the clj-rewrite structures instead of taking and returning raw Clojure forms? Is is just for performance? Not complaining or anything, just thinking about linting Convex Lisp (very similar to Clojure) and wondering about what you really gain by keeping that kind of AST.
@adam678 The reason is preservation of information mostly
when I wrote the hooks stuff, I did try to make it look like normal macroexpansion, but this didn't work out as you would lose too much location information, e.g. when you transform a body that contains numbers, strings, etc
so I decided to expose the structure that clj-kondo itself uses
and by now rewrite-clj is a pretty solid library in the clj ecosystem
Now that you mention it, it's true there is quite a lot you could loose by using sexprs only, depending on use case 👍