Yay – you receive a notification for a code review in a pull request on GitHub. You open the files changed tab on GitHub and there it is: a basic UI showing you nothing more than a git diff. Surely, there is a better way to look at the changes, including comments, and navigate to them, right?
git diff
is a great tool used by millions of developers every day. One of the ways developers consume it is through the UI of GitHub, GitLab, or Bitbucket when you doing a code review.
Unfortunately, what you see is literally what you get out of the git command.
For example, here is what you see on GitHub.com for the following pull request of the google/guava project:
We believe that in 2021, developers deserve better than having to exhaustively check textual diffs and try to reverse engineer the context of the changes.
So we have incorporated into Reviewpad a special diff operation that captures an overview of the changes at the semantic level:
The Explore Tree was designed to immediately answer the following questions:
- From the list of modified files, which have changes that involve semantic changes and how many changes occurred?
- Which semantic objects (e.g. methods and classes in Java) were modified and which type of modification (added, removed, or changed)?
- Which files or symbols contain comments?
Answering these questions has saved us a lot of review time as the tree also acts as an index into the diff, and allows us to navigate directly into it.
In order to compute the Explore Tree, Reviewpad performs a semantic diff of two versions of the file, restricted only to the hunks associated with the git diff. From there, the challenge is to understand which symbol (function, method, class, type, etc) is associated with this change. We’ll write more details about the analyser in a future post. 😉
Cool. How do I check this out by myself?
We have a public beta version of Reviewpad available at beta.reviewpad.com. You will need to create a new account and once you log in for the first time, you will see the following page to connect to a code host:
You can connect to GitHub through our OAuth app or manually add a personal access token. The OAuth requires minimal scopes to be able to read and comment on public repositories.
And voilà – you are ready to get started with Reviewpad!
Our semantic analysis works for more than 10 languages including: C, C++, C#, Go, Haskell, Java, Javascript, Proto, Python, Ruby, Rust, Swift and TypeScript.
We are adding more and more open source projects in different languages so that you can check it out easily. Feel free to reach us on our community Slack with requests!
Top comments (1)
Hey, happy to answer questions about semantic diffs and Reviewpad in general!