codeapprove / feedback

Feedback for CodeApprove
0 stars 0 forks source link

Reviewable produces slightly cleaner diffs #4

Open mtlynch opened 2 years ago

mtlynch commented 2 years ago

I ran into an instance where Reviewable and CodeApprove produce slightly different diffs and wanted to share it.

Full diff in patch format: https://patch-diff.githubusercontent.com/raw/tiny-pilot/tinypilot/pull/1043.patch

Before

import flask

import git

class Error(Exception):
    pass

class GitError(Error):
    pass

class VersionFileError(Error):
    pass

After

import json
import urllib.request

import flask

class Error(Exception):
    pass

class VersionFileError(Error):
    pass

class VersionRequestError(Error):
    pass

The lines that don't change are:

import flask
...
class Error(Exception):
    pass
...
class VersionFileError(Error):
    pass

Github & CodeApprove

Github and CodeApprove perform about the same, viewing almost every line as changing:

image

image

Reviewable

Reviewable manages to perform a little better, as it recognizes that the import flask line is unchanged, though it still marks the class VersionFileError(Error): line as having changed:

image

It also does character-level diffing on the symbol names, although I don't think that's obviously better than word-level diffing in this context.

hatboysam commented 2 years ago

@mtlynch thanks for the super clear example here! CodeApprove and GitHub use identical diffs at the moment (although with some differences in sub-line highlights) so it's good to know where other tools are doing better.