I have a macro that wraps a usage of a function that comes from another ns
(cp/upmap pool (fn [data] (-> data n/my-fn!)))
it gives me
"namespace n is required but never used"
"n/my-fn! is required but never used"
how can I solve this?
(without putting an ignore on require
perhaps the hook for claypool hides the n/my-fn node? I don't understand the exact output you mention though. can you perhaps make a screenshot with the errors or better yet, a github repo I can clone?
Is it possible to :analyze-call of java class constructors or interface methods? I can get static methods (`newFixedThreadPool`) to trigger successfully.
:hooks {:analyze-call {
java.lang.Thread. hooks.metabase.concurrency/lint-unsafe
java.util.concurrent.Executor/submit hooks.metabase.concurrency/lint-unsafe
java.util.concurrent.Executors/newFixedThreadPool hooks.metabase.concurrency/lint-unsafe
}}
src:
(java.lang.Thread. )
(.submit clojure.lang.Agent/pooledExecutor ^Runnable (fn []))
(java.util.concurrent.Executors/newFixedThreadPool 1)
I think it's possible but per method
constructor isn't support I think
currently
you could try java.lang.Thread/. but I don't think that will work
clj-kondo expands (java.lang.Thread.) to (new java.lang.Thread)` and then linters that
we could add support for java.lang.Thread/new I guess
instance method aren't supported either currently
since often the type isn't known
(to clj-kondo at least)
Yeah, java.lang.Thread/. and java.lang.Thread/new don't work either.
Yeah, instance methods would be more difficult but would be nice for us since we often tag (`^Executor`) objects.
perhaps we could do it without hooks, more like the discouraged-var-linter
but I guess you would have to specify the exact overload as well
since one overload might be safe and the other not
Hrm, seems like static methods don't get picked up by discouraged-var
as of now, they don't. but I was proposing like that linter, instead of having to use hooks for it
so a new linter