Hi everyone, small question: using both kondo and joker in emacs currently, but thinking about getting rid of joker. Is kondo a full replacement currently or still better to keep 2 linters?
I have been running joker alongside clj-kondo (since I started with joker and then was inspired to build clj-kondo) and I think it would be safe to say that clj-kondo covers 99% of joker and offers a ton more linters. There might be very minor things like (let [])
(warn on empty body in let) that are not in clj-kondo due to nobody asking for it but those are easy to add.
thanks a lot @borkdude!
Naive question: Is the fact that a dissoc on a record’s field returns a map instead of a record lint-worthy? Or is this something folks do normally and intentionally?
(defrecord MyRecord [field1 field2])
(def r (->MyRecord "22" "23"))
(dissoc r :not-a-field)
;; => #user.MyRecord{:field1 "22", :field2 "23"}
(dissoc r :field1)
;; => {:field2 "23"}
@lee detectign the type seems hard 99% of the time
Although it'd be useful in the "this" case of a record
@lee What lint warning would you expect in which example?
I was thinking the second dissoc might warn “a dissoc on a record returns a map”
I was not thinking of a warning on the first dissoc... was just trying to show a record was returned in that case.
but maybe wanting to convert a record to a map in this way is a normal thing? I am too naive to know. 🙂
It's not often what you intend.
Good to know, @dominicm, thanks, (dec lread-naiveness)
Most common bug of this kind I see is:
(defrecord DBComponent [conn-opts db]
component/Lifecycle
(start [this] …)
(stop [this] (dissoc this :db)))
I don't remember if it matters in that exact position, but I think it's warned about.
Maybe this is more a case for clojure.spec since for clj-kondo it's not impossible but hard to know what dissoc on something is going to return and if this is or is not intended.
But I'll keep it in mind
Coolio! Thanks @borkdude.