jonase/eastwood

unused-namespaces false positive with vars marked ^:const

camsaul opened this issue · 3 comments

It looks like the :unused-namespaces linter is giving false positives when only constants are used from another namespace.

Example:

a.clj
(ns proj.a)

(def ^:const version "1.0.0")
b.clj
(ns proj.b
  (:require [proj.a :as a]))

(defn project-info []
   {:version a/version})
Error
src/proj/b.clj:1:1: unused-namespaces: Namespace proj.a is never used in proj.b

I'm seeing the same thing with macros too. If these issues are hard to fix, it would be really helpful if I could exclusions for certain namespace usages in my Eastwood config file 👍

I've looked into this a bit, and it isn't obvious if there is a quick straightforward way to account for these namespace uses for vars declared with ^:const in other namespaces. I'll keep the issue open in case someone thinks of a way.

vemv commented

This was fixed with #363 , anyway I'll add a specific unit test relative to this issue