Sun Feb 28 2021

Review your own code

There's something I do every time I put code up for review, after I think it's ready for someone to look at it, but before I actually ask them. It's a simple thing, doesn't take long, but I almost always catch a few things.

I look at it on GitHub.

When I'm looking at code in my editor, I like my dark theme. It creates a comfortable atmosphere – cozy, easy on the eyes. It gets a little romantic. Then when I look at the same code outside my editor, I see it in a new light. I catch commented-out code blocks, errant console.logs, the odd TODO I never got back to.

Ever since GitHub added dark mode I've been tempted, but the default theme triggers my brain in a way that's too valuable to lose. Seeing the code in GitHub's stark white, mint, and peach triggers the reviewer's instinct deep within my brain.

Sarah Drasner (Netlify, Vue.js) takes this one step farther, and submits PRs to herself.

I write it as someone who's just trying to get the stuff done, and then when I submit the PR to myself, I read it as someone who has to maintain the code later.

So whether you're contributing to open source, submitting to your team's review queue, or just asking your buddy to look over your code before merging to master, respect your reviewer's time. Give it a once-over in the harsh light of GitHub and make sure it's code you would want to review!