api-diff icon indicating copy to clipboard operation
api-diff copied to clipboard

Consider showing additions

Open lread opened this issue 4 years ago • 5 comments

Proposal Api-diff currently shows what has been removed. The (very worthy) focus, it seems, is on discovering breakages.

It can also be interesting to see what was added to an API. What new things can I do?

This can be achieved by swapping x1 and x2 in the diff comparison, but this, to me, seems awkward because the diff is still described in terms of removals.

Implementation ideas Show the user:

  • new vars
  • new arities

What might we report? Maybe something like:?

x/y/z.cljc:10:1: info: x.y.z/new-def-x was added.
x/y/z.cljc:20:1: info: x.y.z/changed-defn-y Arity 10 was added.
x/y/z.cljc:30:1: info: x.y.z/new-defn-z was added.
x/y/z.cljc:30:1: info: x.y.z/new-defn-z Arity 1 was added. 

We would also need to include reason of additions, see #13.

test-resources/older/example.clj:6:1: info: example/becomes-public now public.
test-resources/older/example.clj:8:1: info: example/loses-nodoc now included in diff (meta :no-doc).

To work out

  1. Is this idea interesting?
  2. Optionally or always show additions?
  3. Or only show one of: additions or removals?
  4. Separate additions from removals in reporting? One tells about breakages, the other about opportunities.

Next steps Refine with anybody who might be interested in this feature.

lread avatar Oct 21 '21 19:10 lread

Yeah, this seems nice!

borkdude avatar Oct 22 '21 08:10 borkdude

This can be closed I guess?

borkdude avatar Oct 24 '21 08:10 borkdude

Nope, have not started on this one yet! 🙂

lread avatar Oct 24 '21 12:10 lread

Oops, sorry, I was mixing stuff up.

borkdude avatar Oct 25 '21 15:10 borkdude

No problemo, the fact that I referenced this issue from a PR was what probably caught your eye.

lread avatar Oct 25 '21 15:10 lread