-
-
Notifications
You must be signed in to change notification settings - Fork 297
Description
[ Leave this text in if you want to promote it. ]
- I have read the Clojure etiquette and will respect it when communicating on this platform.
[ To keep development of this project going, consider sponsoring. If you are
already a sponsor, thank you! You can remove this message. ]
Is your feature request related to a problem? Please describe.
clj-kondo currently doesn't warn about duplicate symbols in :exclude clauses within ns forms. This can lead to redundant and potentially confusing namespace declarations, similar to how duplicate refers are already detected.
Describe the solution you'd like
Add a new linter (e.g., :duplicate-exclude) that detects and warns about duplicate symbols in:
(:refer-clojure :exclude [sym1 sym2 sym1])- duplicate in refer-clojure exclude(:require [some.ns :exclude [sym1 sym2 sym1]])- duplicate in require exclude
The warning should be similar to the existing :duplicate-refer linter.
Describe alternatives you've considered
- Keep relying on manual code review to catch duplicates
Additional context
Currently, clj-kondo successfully detects duplicate refers:
;; This produces: "Duplicate refer: split"
(ns foo (:require [clojure.string :refer [split split]]))But does not detect duplicate excludes:
;; This produces no duplicate warning, only "Unused excluded var: map"
(ns foo (:refer-clojure :exclude [map map]))The new linter would provide consistency with the existing duplicate detection capabilities and help catch redundant namespace declarations early.