Twitter github

Improved GitHub Code Review Tools

The default GitHub code review experience has always been lacking for me, especially when it comes to code review enforcement. I definitely admit to my bias of being a Gerrit code review fan but at least GitHub is moving in the right direction with recent code review improvements earlier this year.

On the bright side, GitHub has a fairly open API and there’s been a great ecosystem of tools that have popped up that help deal with some of the shortcomings in my opinion. Even more so after GitHub opened up the commit status API, it’s definitely enabled some interesting workflows.

PullApprove

One interesting code review workflow involves enforcing that changes must be reviewed by certain team members (which is a fairly common code review practice). In my opinion, the best tool that I’ve come across that handle this scenario is PullApprove. All you need is a simple metadata file that formalizes your requirements, and you’re good to go, here’s an example of what we use in the OCI project:

approve_by_comment: true
approve_regex: '^(Approved|lgtm|LGTM|:shipit:|:star:|:\+1:|:ship:)'
reject_regex: ^Rejected
reset_on_push: true
signed_off_by:
required: true
reviewers:
teams:
- image-spec-maintainers
name: default
required: 2

The important pieces here are the approve/reject regexes which dictate what terms will be used to approve and reject changes:

As a bonus, the “signed_off_by” setting can be used to enforce DCO which is to make sure your commits are properly signed off for DCO purposes.

LGTM

I also want to give an honorable mention to LGTM which is a simple pull request approval system that is open source but not as configurable as PullApprove IMHO.

Reviewable.io

For any large scale and high velocity projects on GitHub, managing what you need to review can be a daunting task. I’ve personally found Reviewable.io as an interesting tool that helps address the problem of managing the context of what you looked last and what’s on your queue.

Anyways, hope this helps and happy code reviewing! If you’re interested in more integrated GitHub code review tools, I highly recommend checking out the GitHub integration directory.