Skip to content

Commit

Permalink
Fix clj-kondo#2424: combination of config-in-ns and discouraged-names…
Browse files Browse the repository at this point in the history
…pace (clj-kondo#2454)
  • Loading branch information
borkdude authored Dec 13, 2024
1 parent f2a4608 commit 97ea8e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For a list of breaking changes, check [here](#breaking-changes).
- Relax `:redundant-nested-call` for `comp`, `concat`, `every-pred` and `some-fn` since it may affect performance
- [#2446](https://github.com/clj-kondo/clj-kondo/issues/2446): false positive `:redundant-ignore`
- [#2448](https://github.com/clj-kondo/clj-kondo/issues/2448): redundant nested call in hook gen'ed code
- [#2424](https://github.com/clj-kondo/clj-kondo/issues/2424): fix combination of :config-in-ns and :discouraged-namespace

## 2024.11.14

Expand Down
2 changes: 1 addition & 1 deletion src/clj_kondo/impl/linters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
:let [linter-config (apply config/merge-config! linter-configs)
{:keys [message level]
:or {message (str "Discouraged namespace: " ns-sym)}} linter-config
ctx (assoc ctx :lang lang :base-lang (:base-lang ns))]]
ctx (assoc ctx :lang lang :base-lang (:base-lang ns) :config config)]]
(findings/reg-finding!
ctx
(-> (node->line filename ns-sym :discouraged-namespace message)
Expand Down
7 changes: 7 additions & 0 deletions test/clj_kondo/discouraged_namespace_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@
:name clojure-core-namespaces}]
:linters {:discouraged-namespace
{clojure.java.jdbc {:message "Use next.jdbc instead of clojure.java.jdbc"}}}}))))

(deftest config-in-ns-test
(is (empty? (lint! "(ns repro
(:require [discouraged :as d]))
(d/foo)"
'{:config-in-ns {repro {:ignore [:discouraged-namespace]}}
:linters {:discouraged-namespace {discouraged {:message "discouraged ns"}}}}))))

0 comments on commit 97ea8e3

Please sign in to comment.