Open lread opened 3 years ago
This seems rather unlikely? Also, the var could have become something like (def foo (partial bar 1))
so in theory it could still be a function.
Oh right... hard to detect callability.
I had tried this def
:
❯ clj-kondo --config '{:output {:format :edn :analysis true}}' --lint - <<< '(def bar (fn [x y x]))' | jet --pretty --query ':analysis :var-definitions'
[{:fixed-arities #{3},
:end-row 1,
:name-end-col 9,
:name-end-row 1,
:name-row 1,
:ns user,
:name bar,
:defined-by clojure.core/def,
:filename "<stdin>",
:col 1,
:name-col 6,
:end-col 23,
:row 1}]
And saw the arity, but of course, clj-kondo will only do so much here, when I try your example I see your point:
❯ clj-kondo --config '{:output {:format :edn :analysis true}}' --lint - <<< '(def foo (partial bar 1))' | jet --pretty --query ':analysis :var-definitions'
[{:end-row 1,
:name-end-col 9,
:name-end-row 1,
:name-row 1,
:ns user,
:name foo,
:defined-by clojure.core/def,
:filename "<stdin>",
:col 1,
:name-col 6,
:end-col 26,
:row 1}]
I know this kind of diff is unlikely... but as I user, I see any potential API breakage as very interesting.
Ideas:
:defined-by
changes as potentially interesting?Although the return type of partial
is a function so we could still support that in clj-kondo, e.g with :ifn true
or :ifn false
or so.
If v1 has
And v2 has:
An arity 0 deletion is currently reported. This is an indicator of breakage and might be good enough.
But if we swap v1 and v2 we get no report which is not ideal.
Perhaps we could instead report when something has become callable (or not callable) as a breakage.
(BTW: I'm not suggesting that we evaluate based on
def
vsdefn
but rather on the presence or absence of any call signatures found by clj-kondo).