I was recently asked to share the code review policy I maintained when working with Medium Engineering and I thought it could be useful to others.
Exceptions:
Note: Even changes that are exempted from a code review should be made as a pull-request that can then be immediately merged.
Code reviews perform multiple functions: to maintain the quality of the codebase; to ensure consistency; to spread knowledge.
As the code submitter, you are expected to:
As a code reviewer, you are expected to:
When choosing a reviewer, identify someone who is already familiar with the code you are changing. Do not add a laundry-list of names to the review, add the minimal set of people who are qualified to cover all facets of the change (e.g. backend, frontend, models, feature specific).
One of the main limitations of the GitHub review process is knowing whose turn it is. In order to avoid reviews stagnating we should be explicit about when a step has finished.
At Range we used a Pull Request Template to streamline the flow and help us remember what to include.
Here’s a slightly adapted version:
#### What's this PR do?
#### Where should the reviewer start?
#### Any background context you want to provide?
#### What are the relevant tickets?
#### Screenshots (if appropriate)
#### What gif best describes this PR or how it makes you feel?
#### Definition of Done:
##### Code reviewers, by giving a LGTM you attest that:
- [ ] Commits are adequately tested
- [ ] Code is easy to understand and conforms to style guides
- [ ] Incomplete code is marked with TODOs
- [ ] Code is suitably instrumented with logging and metrics
- [ ] [Security Requirements](insert-link) have been considered
- [ ] [OWASP Top 10](https://owasp.org/Top10/A00_2021_Introduction/) have been considered
##### For terraform changes:
- [ ] Change should be applied to staging prior to code review
- [ ] Change should be applied to production after approval and before merge
- [ ] Change should be backwards and forwards compatible
- [ ] Network and data flow diagrams (`docs/diagrams/`) are up-to-date
A bunch of Medium alumni use my git-workflow script for branch management and initiating pull requests from the command line.
$ git start new-feature
~ HACK HACK HACK ~
$ git cam 'New feature'
$ git sync
$ git pull-request
$ git switch bug-fix