How to review pull requests

October 16, 2021
views 2 min read

I believe that reviewing pull requests is some sort of art. It requires patience and you need to put yourself on the other side of the pull request. In this article I go through a few example of approaches I think can be improved.


1. Be kind

Remember there's someone on the otherside.

Using

useEffect
here doesn't make any sense.

Maybe we can remove

useEffect
and assign the
data
directly to the state once the component loads.


2. Resources

When possible provide resources.

There's a lot of repeated code, you need to apply the DRY principle.

I believe we can re-use a lot of this code, take a look at the DRY principle and let me know if you need a hand with it.


3. Constructive Feedback

Respect people's emotions.

This is wrong, why don't you move this to a new file?

You could improve this component by moving this code to a new file.


4. Precision

Be as clear as possible when commenting a PR.

These constants have similar names.

I suggest changing these constants names, something like

API_ENDPOINT
and
GRAPHQL_ENDPOINT
, open for discussion though.


5. Confidence boost

Always try to leave a positive comment when you're done reviewing a PR, costs nothing and trust me, it'll make a huge difference to the PR author.

Reviewed. Left some comments.

Left some feedback. Overall great job, just a few tidy ups and we're good to go 🚀


Wrapping up

These are just a few points to be more kind and getting a little better at reviewing pull requests, there's a lot more to take into account, but starting with these 5 points is already a great improvement.

Hope it was helpful.

Read next
I thought I wanted the Twitter Verification Badge
June 1, 2021
views