Using Asana for Code Review
We recently switched our three-person (and growing) engineering team to use Asana for an agile-ish workflow. By ‘ish’ I mean we are doing test-driven development in short iterations with regular stand-up meetings and code review… but we’re flexible. We chose Asana for three main reasons:
It’s a hosted / SaaS solution - we’re small and we’re trying to use SaaS wherever possible (more on that in a later post). In the past I’ve had experience running tools like Trac on internal servers or cloud VMs: it’s not that hard but it does take time to maintain (usually when something like a hard disk breaks and you have a release due next day).
The rest of Harry’s runs on Asana - from supply-chain to customer experience, most of the teams here are using Asana to plan and track their tasks. With the tech team on Asana too they can have insight into our progress and we can do things like assign tasks to stakeholders on other teams.
It’s flexible - using a combination of tasks and sub-tasks, we’ve set up a code review workflow in Asana and written an small command-line tool to tie it all together.
Why Code Review?
You’re kidding right? As Lee Winder eloquently stated code review improves quality by:
- catching bugs earlier
- encouraging test coverage
- knitting the team together by sharing domain knowledge and knowledge of the code base
- reducing code duplication and non-idiomatic code styles
In short, it’s not really optional.
But Code Review is a Drag!
Code review is something that we software engineers have to be diligent about. My personal preference is to set up a mandatory code review step before code enters a shared branch, à la GitHub pull requests. This is especially useful for larger feature development: develop on a feature branch and enter a pull request for merging to master. For smaller changes, however, this can be hard to keep up with for a small team, and finished code ends up lingering in pull requests. We decided to handle the smaller code reviews as an ‘audit’ after the fact, and keep track of which code needs review in Asana.
Code Review, Meet Asana
We’re tracking code reviews in Asana using a couple of features:
Add a subtask to code-complete tasks, assigned to the appropriate person. This subtask is tagged ‘codereview’ so that we can easily view pending reviews.
We have the Asana GitHub service hook enabled, which adds a comment on the task pointing at any commits which reference the task ID in their commit messages.
The reviewer will then check over the commits (often this is a branch which can be diffed like a pull request) and approve the task or request changes.
In this example I accepted the changes Dan made for this small task:
Making it easy
Finally, let’s stay on the command line as much as possible. We wrote a little tool to parse the commit message and assign any referenced tickets for code review.
cr [-a ASANA_ID] [-g GIT_COMMIT] username
By default it uses the last commit message, but you can pass a particular commit or an Asana task ID.
Find the script in this gist.