borkdude/api-diff

Ignore private vars when comparing

Closed this issue · 1 comments

lread commented

Proposal
Private vars should always be excluded when comparing APIs.

How does it work now?
If we update test-resources/older.clj to add pf and p:

(ns example)

(defn- pf [])
(def ^:private p 3)
(def x 1)
(def y 2)
(def z 3)

And the run an api-diff like so:

❯ clojure -M -m borkdude.api-diff :path1 test-resources/older.clj :path2 test-resources/newer.clj
test-resources/older.clj:3:1: warning: example/pf was removed.
test-resources/older.clj:4:1: warning: example/p was removed.
test-resources/older.clj:6:1: error: example/y was removed.
test-resources/older.clj:7:1: warning: example/z was deprecated.

You'll notice that pf and p are reported as removed.

How I propose that it works
I would expect p an pf to not be reported:

❯ clojure -M -m borkdude.api-diff :path1 test-resources/older.clj :path2 test-resources/newer.clj
test-resources/older.clj:6:1: error: example/y was removed.
test-resources/older.clj:7:1: warning: example/z was deprecated.

Next steps
I can follow up with a PR if you agree.

I agree. If possible also provide a test.