clj-kondo 2026-07-27

clj-kondo flags this in the Clojure CLI's own deps.edn file:

:aliases {
    :deps {:replace-paths [] ;; <=== flagged as Suspicious alias name: deps
           :replace-deps {org.clojure/tools.deps.cli {:mvn/version "0.31.158"}}
           :ns-default clojure.tools.deps.cli.api
           :ns-aliases {help clojure.tools.deps.cli.help}}
    :test {:extra-paths ["test"]}
  }
What's the thinking behind that linter? And what other alias names would it flag?

I suppose normally the :deps key would be either top-level or inside an alias, so it could signal an accidental change to deps.edn?

Alex Miller (Clojure team) 2026-07-27T20:05:17.142459Z

:deps is defined in the root deps.edn, so using your own would override it

1

Except this is the "root deps.edn" file because it's in the Clojure CLI install folder. It just happens to be vendored into our repo at work. I think it's the first time I've ever seen Kondo flag this (I had zero problems in the repo, until I picked up the latest LSP + Kondo I think). Hence my curiosity.

yes, kondo warns about root aliases that you're not supposed to override in your user files. who the hell lints the root deps.edn? ;)

Looking in the source I see :deps :extra-deps :jvm-opts are all considered suspicious and that code has been there for 6 years. So I guess I'm surprised Kondo didn't warn before...

:extra-deps and :jvm-opts are not "root aliases" but it still warns about those 🙂

they are likely misplaced keys, that's why it warns, at least that's my guess

I've just never seen it warn about that file before, so that's more my question now. That file has been in our repo for years, and it wasn't warning about it the other day...

you can lint with the previous version to see if it did

Perhaps it's because that file got updated recently, and Kondo had ignored it before for some reason?

clj-kondo doesn't ignore files based on their mtime or anything

Expected. So, it's a mystery. And it doesn't seem possible to turn this linter off?

(I can easily exclude the folder the Clojure CLI is in, but the deps.edn linters don't seem to have :key-word-names to turn on and off?)

Since I got down to zero Kondo warnings a while back, any new ones are very noticeable 😄

@seancorfield can you send me a file so I can repro locally?

https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#depsedn this is the responsible linter for it you can disable it with #_{:clj-kondo/ignore [:deps.edn]}

This cond-> used to get flagged as :constant-condition (for the :go condition) so I added a :clj-kondo/ignore directive. However, in the latest version of Kondo, it warned that directive was unnecessary, and when I removed it, the cond-> is no longer flagged. Was that a deliberate change?

#_{:clj-kondo/ignore [:constant-condition]}
      (cond-> req
        :always             (assoc :version/tag  (str "?v=" (:version sys)))
        (:development? env) (assoc :cache/buster (str "?" (rand-int 1000000)))
        (:qa? env)          (assoc :cache/buster (str "?" (rand-int 1000000)))
        :go                 (handler))
ISTR we talked about conditions with explicit local nil or false values. Did you ease off to allow all keywords to be treated as truthy?

why would it get flagged for :go but not :always? 🤔

Because it treats :always as a special case in the Kondo source code 🙂

I see a recent commit to add the :always special case back after expanding :condition-always-true but I think not flagging :go here might be a bug @borkdude?

I decided to allow all keywords in cond-> since I couldn't find a true positive

since the last release

Cool! Thanks. I just wanted to make sure this was expected. I see where it was temporarily not allowing :always and that got fixed in this commit https://github.com/clj-kondo/clj-kondo/commit/004ae156b2ae2dc46ea9438c9e5add375719602a but I couldn't tell whether "all keywords" became the logic in later commits.

yes, I can confirm that

👍🏻 1

side note: I have grown a dislike towards using constant conditions in cond-> and adopted a style of nesting threading macros:

(-> req
    (assoc :version/tag (str "?v=" (:version sys)))
    (cond->
      (:development? env) (assoc :cache/buster (str "?" (rand-int 1000000)))
      (:qa? env)          (assoc :cache/buster (str "?" (rand-int 1000000))))
    (handler))

We do that in most places but there are a few places where that extra nesting just makes the code harder to read (we have several cond-> forms where everything is a "real" condition, except the very last one is :always true).

yeah, your version reads nice and tabular in this case

Example:

(cond-> criteria
                  (not (contains? criteria min-k))
                  (assoc min-k (str (:minValue criterion)))
                  (not (contains? criteria max-k))
                  (assoc max-k (str (:maxValue criterion)))
                  (= :height name-k)
                  (adjust-height-range criterion)
                  :always
                  (as-> c (assoc c display-k
                                 (str (get-in criterion [:lookup (get c min-k)])
                                      " - "
                                      (get-in criterion [:lookup (get c max-k)])))))
Wrapping that in -> just to avoid :always doesn't help readability IMO.

(and some of this code is close to 15 years old and we don't want to touch it 🙂 )

no use being a zealot if there is no need

➕ 1