What's your code review process and tooling?

Even in my tiny team at freistilbox, code review is a common practice. Sixteen years of building a real product have taught us that good code hygiene is an important part of a reliable and maintainable codebase. When a pull request isn’t just a trivial change, we ask each other to take a critical look at it and provide feedback before we hit the ‘Merge’ button.

Now, code review can be challenging. And I don’t just say that with regard to the required levels of engineering skills and empathy. For me, it actually starts with ergonomics.

I prefer to review code in the terminal. The main reason is that in the terminal, I can determine my own font size. My eyes weren’t great from early age on, and over the decades, they’re not getting any better. In consequence, the small font that the web-based forges like GitHub or Forgejo use makes code review a struggle for me. I want to squint only when I’m discovering strange code! :wink:

Another reason to review code in the terminal is that I have a great choice of tools. I started out with the diff viewer built into git, and went on to try delta and difftastic, two great alternative diff viewers that integrate nicely into git.

Recently, a relatively new tool called Hunk has become a great help in my code reviews. Hunk has a more advanced user interface than the tools I used to use before it. You can even use it completely mouse-driven, although it’s a terminal application. If you just use hunk diff or hunk pager, it’s already of great value.

However, the feature that makes it really stand out is its coding agent integration. (Who groaned there in the back?) Hunk comes with a skill, i.e. a set of instructions that the agent can find and load by executing hunk skill path, that tells it how to access a running diff session. This creates a bidirectional communication channel between the agent and the reviewer using Hunk. Similar to how it works on a web-based forge, a reviewer can attach comments to specific lines of code. And the agent can immediately respond to them. What’s also cool is that the other direction works, too. When you’re exploring a foreign codebase, you can ask the agent to add code comments proactively to highlight important pieces of code. You can even request a guided tour through the whole project. Hunk makes code review a fun interactive process for me.

I configured a git alias that allows me to type git review to execute hunk diff $(git symbolic-ref --short refs/remotes/origin/HEAD) (which usually resolves to hunk diff main). That way, I get a view of all the changes in the current branch or worktree with just a few keystrokes. And it usually only takes a little back and forth with my agent until it all LGTM.

If you do code review, please share your experience: What are your practices, and which tools have you found to be helpful in the process? And regardless if you have experience with code reviews or not, is there anything you’d like to ask?