Improving Our Code Review Workflow with a Browser Extension
The Dashlane engineering team recently moved to GitLab to handle all its repositories. GitLab has great advantages for us, such as a powerful pipeline system for continuous integration. However, moving to a new system results in deep changes to the usual workflow and the learning curve can be steep. As it's important to reduce friction, building new tools to improve your workflow is a good option.
Reviewing merge requests on GitLab
Having a good workflow for code review is really important. For our projects we set between two and three team members to review our code. If they didn't see they were assigned to the merge requests, then the time to review may be very long. In other words this can lead to an important delay to ship a release.
While using GitLab we discovered that the visibility of the merge requests was not ideal for us. Here are some of the difficulties the team faced:
- The count number in the menu bar displays the number of merge requests you are assigned to but if you have already reviewed everything it still shows up.
- On the merge requests page you can see the merge requests you are assigned to but not the ones you created, so some people started to assign themselves to their own merge requests.
- The listing of merge requests lacks detail. You can see how many approvals you are missing but it's not possible to know who did not review your code.
- When GitLab is closed it's not possible to see or be alerted of the pending merge requests.
- The notification system by email is challenging to configure properly in order to get accurate alerts.
All those limitations generated delays in our code review process so I decided to create a tool to improve the situation.
Few solutions were available. The first one was to create a Slack bot that would send to each team the daily/hourly new merge requests to look into and tag people on Slack. Good thing about getting an instant message, you get it, but over time you get annoyed and you mute the bot. This solution is in use by our Android team, however it's a bit tricky to implement. It requires a server and some customization each time a new member joins the team. In the end, I thought it was not scalable nor generic enough to be used by everyone.
So, I decided to work on an alternative, based on a browser extension.
GitLab Notify Extension
Browser extensions are a good compromise between a website and a heavy client. They are easy to install through the browser stores and easily available as your internet browser is most of the time always open.
The goal of GitLab Notify is to cover all the previously listed improvements with a simple extension that can be used by anyone.
The extension is displayed at any time in your browser top bar and shows a badge with the number of merge requests that need your attention. When you click on it, a popup appears with the list of merge requests you are assigned to. The ones you already reviewed are grayed at the bottom so you can focus only on the pending ones.
The second tab shows the merge requests you created and tells you which ones are good to be merged. I made sure to display as much information as I could need without opening GitLab, such as: who already reviewed the merge request, the creation date, the number of comments, the title and description, as well as the branch name so you can checkout easily on it to start your review.
As we started to use it at Dashlane here are some comments I gathered:
To conclude, creating this extension solved the frictions we had while using GitLab and the time between assigning a review and its start has been reduced. In the future, we could add new features such as desktop notifications or pending discussion thread alerts and offer more customizations to fit everyone's need.
Because it's important for everyone to improve efficiency while working I decided to make this extension free and open-source. The code is available on this public repository. Feel free to contribute and add more functionality to it.
If you just want to jump in and start using the extension you can download it on the following stores: