Skip to content

Commit

Permalink
Exclude instances of nesting when directly inside threading macros
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdl89 committed Nov 21, 2024
1 parent 82bec59 commit bc0a650
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/clj_kondo/impl/linters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,14 @@
(defn lint-redundant-nested-call
"Lints calls of variadic functions/macros when nested."
[call]
(let [[[call-ns call-name] parent] (:callstack call)]
(let [[[call-ns call-name] parent [grandparent-ns grandparent-name]] (:callstack call)]
(when (and (utils/one-of call-ns [clojure.core cljs.core])
(utils/one-of call-name [* *' + +' and comp concat every-pred
lazy-cat max merge min or some-fn str])
(= [call-ns call-name] parent))
(= [call-ns call-name] parent)
;; Exclude instances of nesting when directly inside threading macros
(not (and (utils/one-of grandparent-ns [clojure.core cljs.core])
(utils/one-of grandparent-name [-> ->> cond-> cond->> some-> some->> as->]))))
(node->line
(:filename call)
(:expr call)
Expand Down

0 comments on commit bc0a650

Please sign in to comment.