Logo

dev-resources.site

for different kinds of informations.

Review your own pull request (PR)

Published at
1/13/2025
Categories
programming
softwaredevelopment
productivity
learning
Author
samuelko123
Author
11 person written this
samuelko123
open
Review your own pull request (PR)

Once upon a time, a developer created a PR and requested for review.

Little did he know:
❌ He misspelt a variable name.
❌ He forgot to remove a console.log("testing").
❌ He overlooked a // TODO: refactor this code.

As such, it took several rounds of review to get it across the line.

Had he reviewed his PR first, he could've avoided this disaster.

What is a PR?

A PR is basically a request of "May I put some code changes into your branch?".

In a collaborated environment, the main branch is usually protected. It means that you need to create a PR and obtain an approval to contribute your code changes.

Why should I review my own PR?

Can you please approve my pull request?

One may say, "I know my code and it works. Why should I review my own PR?"

To answer that, let me introduce a new made-up word - Approvability. πŸš€

Achieving "It works." is the first step of creating a PR. Getting someone to approve it is the goal.

From a reviewer's point of view, it's much easier to approve an easy-to-follow PR than one that exhausts their brain power with ambiguous function names and obscure logic.

Apart from approvability, self-review can:

1. Eliminate stupid mistakes

Trivial mistakes like typos and code misalignment can make yourself look unprofessional.

2. Enhance readability

If you have a hard time reading your code, the reviewer will have an even harder time reviewing your code.

3. Improve code quality

When you review your own code changes from a bird's eye view, you may come up with refactoring ideas. πŸ’‘

How should I review my own PR?

Review it like a PR from someone else.

Ask yourself:

1. Does it satisfy the requirements?

When we're so focused to make the code work, we could miss some of the requirements.

We don't want the tester to come to us and say "It doesn't work!", right?

2. Does it exceed the requirements?

When we code, we may see things that we want to refactor (or fix). Very often, those refactoring are unrelated to the requirements.

It's called scope creep. The result is a PR with two sets of changes entangled together, making it harder to review.

When it happens, consider splitting the additional code changes to another PR. It will make your reviewer's life easier. ☺️

3. Do I need to think twice to understand the code?

If yes, it means that the reviewer will need to think 3+ times.

When it happens, we have 3 options:

  • Refactor the code to make it more readable
  • Use code comment to explain the "why" (but not the "what")
  • Use PR comment to invite discussions

4. Does the commit history make sense?

Reviewers may rely on commit history to follow your train of thoughts.

Before requesting for review, you have the opportunity to tidy up the commit history.

After requesting for review, do not force push.


Thank you for reading.
Hope you find this post interesting!

How do you review your own PR?
Share your experience in the comments!

productivity Article's
30 articles in total
Productivity tools and practices enhance efficiency and help individuals and teams achieve more in less time.
Favicon
🚨 The Dangers of Developers Relying Exclusively on AI Without Understanding Fundamental Concepts
Favicon
πŸ•’ What’s your most productive time of the day?
Favicon
The Career Killer Checklist: 10 Common Pitfalls to Avoid in 2025
Favicon
βš–οΈFROM Burn-Out TO Balance-Out (2/4)
Favicon
5 Free AI Design Tools For Designers!
Favicon
Vinny built CoverletterGPT to $500/month, a good read
Favicon
βž‘οΈπŸ’‘Guide, Innovate, Succeed: Becoming a Software Development Leader πŸš€
Favicon
πŸš€ New Book Release: "Navigate the Automation Seas" – A Practical Guide to Building Automation Frameworks
Favicon
Top 10 Web3 Careers for Success: Part 1
Favicon
got Tired of analysis paralyysis so i built an extensioon to get into flow faster
Favicon
Make Better Decisions as a Software Engineer Using the Pugh Matrix
Favicon
[Free Tool] I made an AI-powered content generator for RedNoteApp/Xiaohongshu
Favicon
5 Tools Every Developer Should Know in 2025
Favicon
The Perils of Presumption: Why Making Assumptions in Development is Bad
Favicon
[Boost]
Favicon
#131 β€” Use Association Table to Handle Interval Association
Favicon
How Project Time Tracking Can Enhance Budget Management and Resource Allocation
Favicon
Building An SAAS in 2025-Week 1
Favicon
[Boost]
Favicon
[Boost]
Favicon
🎁 20 Open Source Projects You Shouldn't Miss in 2025
Favicon
🌐 Embracing the Future: Cryptocurrency, Blockchain, and AI Synergy 🌐
Favicon
Ctrl Yourself! VS Code ShortcutsπŸŽ›οΈ
Favicon
Top 50 Websites a Backend Developer Must Know πŸ–₯οΈπŸ”§πŸš€
Favicon
Unlocking the Power of GitHub Copilot: Your AI Pair Programmer
Favicon
Moving Apple Music MP3 Playlists To Android
Favicon
Digital Warm Up
Favicon
πŸ’‘ How Do You Generate Your Cover Images for Blog Posts?
Favicon
What would you say are going to be the Top Trending Topics this 2025?
Favicon
Procrastinator’s Guide to Glory: Turning Wasted Time Into Career Gold with Open Source

Featured ones: