diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ade75ac6f..199da5a106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ For a list of breaking changes, check [here](#breaking-changes). - [#2407](https://github.com/clj-kondo/clj-kondo/issues/2407): support ignore hint on called symbol - [#2420](https://github.com/clj-kondo/clj-kondo/issues/2420): Detect uneven number of clauses in `cond->` and `cond->>` - [#2415](https://github.com/clj-kondo/clj-kondo/issues/2415): false positive type checking issue with `str/replace` and `^String` annotation +- [#2212](https://github.com/clj-kondo/clj-kondo/issues/2212): new linter: `:redundant-nesting` ## 2024.09.27 diff --git a/test/clj_kondo/redundant_nesting_test.clj b/test/clj_kondo/redundant_nesting_test.clj new file mode 100644 index 0000000000..ffad6d578e --- /dev/null +++ b/test/clj_kondo/redundant_nesting_test.clj @@ -0,0 +1,17 @@ +(ns clj-kondo.redundant-nesting-test + (:require [clj-kondo.test-utils :refer [lint! assert-submaps]] + [clojure.test :refer [deftest is testing]])) + +(deftest redundant-nesting-test + (assert-submaps + '({:file "", :row 1, :col 10, :level :warning, :message "Nested use of min is redunant"}) + (lint! "(min 5 2 (min 3 7))")) + (assert-submaps + '({:file "", :row 1, :col 8, :level :warning, :message "Nested use of * is redunant"}) + (lint! "(* 3 4 (* 5 6))")) + (assert-submaps + '({:file "", :row 1, :col 18, :level :warning, :message "Nested use of str is redunant"}) + (lint! "(str \"foo\" \"bar\" (str \"baz\" \"qux\"))")) + (assert-submaps + '({:file "", :row 1, :col 21, :level :warning, :message "Nested use of concat is redunant"}) + (lint! "(concat [1 2] [3 4] (concat [5 6] [7 8]))")))