We released code review functionality back in Deveo 3.0.0. The version was released already on 21st of August 2015, but since then it has taken major leaps forward. The purpose of this blog post is to demonstrate how to set up a branch based code review workflow using feature branches, where every feature that is being developed, and all the changes related to it go through a review and acceptance process. The motivation of this post is to show how easy it is to set up a powerful and enforcing workflow for your projects. Code review workflows can greatly benefit your project and team if you are suffering from bugs that are not caught before releasing the code to production.
If you are too lazy to read the whole post through, you can watch the workflow in practice from the video below:
Creating a Git repository in Deveo
We begin our example by creating a new Git repository. In Deveo all repositories belong to a certain project. For this purpose, we need to create a new project from the dashboard. After creating the project, we can create a new repository through the repositories view. The empty repository shows the clone URL as well as instructions to set things up with Git client.
We can clone the repository to our local machine and add some files to it. In this example, it is sufficient enough to create an
README.md file that will be used throughout this example. We commit and push the changes to Deveo so that it now contains master branch with one file and one commit. Many Git hosting providers and management platforms, Deveo included, recognize
README.md files and render them in the code browser using markdown rendering.
Doing code reviews in Deveo is branch based. In order to follow a code review incorporated workflow, we need to create a new feature branch to our repository locally. We can modify the
README.md file to contain some changes we want to add, and when we commit the code to our feature branch and push the changes to Deveo, they will be shown in the code browser under the created branch.
After the feature branch is pushed to Deveo, we can go to Code reviews view and create a new code review. In the code review creation view, we choose the repository, and the feature branch, as well as the target branch we want the changes to be incorporated. We write a title and a description for the code review, as well as enable voting. Deveo code review allows enforcing how many approvals from others are needed in order to merge the changes from the feature branch into the target branch. In this example, it's sufficient to require only 1 vote.
After creating the code review, the code review details open up automatically. The code review details view shows the current state of the review, including the feature branch and target branch in question, and how many votes are still needed. The view also has the necessary control buttons to upvote, merge or reject the changes by closing the review. In addition, there's also a build status notifier on the right, displaying whether Deveo has been notified of a successful build for the feature branch, but we'll cover that functionality in another post.
The changes tab is the place where we conduct the actual review of the changes. Changed files and the summary of the changes are listed on the top for more quick navigation in larger reviews. At file level, we can comment the code changes line by line. The changes tab tracks the current state of both the feature branch and the target branch, and the review is automatically updated if either of the branches changes. This makes the workflow flexible to the developers, as they can simply commit and push new changes to the same feature branch, or rebase the feature branch to include latest changes from the master branch.
The comments and everything else we do related to the review is listed on the Discussion tab in chronological order. Deveo automatically collapses outdated comments, but they can be expanded if the information is needed later. The comments that are outdated, are naturally hidden from the changes tab as well.
Once the required amount of votes has been reached, the merge button on the top right is enabled. The button is enabled only to those project roles that are able to do the merge to the target branch. Accepting the changes and merging the feature branch to the master branch is done by pressing the merge button. The feature branch can be deleted from Deveo in the same go if the branch is no longer needed.
This blog post covered the basics of how Deveo code reviews work. The code review functionality allows a more enforced process that will catch problems early on instead of too late. Deveo code review functionality supports currently Git repositories, and we are planning to extend the support to Mercurial repositories in the near future, and to Subversion repositories later on.
If you have any feedback on how we could improve the code review functionality, please leave a comment below.