What to Look For in a Code Review
Correctness, then clarity, then style. And how to leave a comment someone can act on.
A review that only comments on formatting teaches nobody anything. The ordering below keeps attention on what matters.
1. Does it do what it claims
Read the description, then the diff, and check they agree. Look for the cases the author did not mention: empty input, one item, a million items, a failure halfway through. Most review value is here.
2. Will it break something else
Who else calls this function? What happens to existing data? Is the migration reversible? A change that is correct in isolation can still break a caller that relied on the old behaviour.
grep -rn "functionName" src
Two minutes of this prevents most regressions.
3. Error handling
Where can this fail, and what happens then? A swallowed exception, an empty catch, a .then with no .catch. Silent failure is worse than a crash because nobody notices it.
4. Clarity
Would someone unfamiliar understand this in six months? Names, comments on the non-obvious parts, and structure. This is not style: a function that does four things is a future bug.
5. Style
Last, and mostly a job for a formatter. If a linter can catch it, let the linter catch it, and keep the human comments for things a machine cannot judge.
How to leave a comment
Say what you observed, why it matters, and what you would do.
This runs a query per row, so the endpoint gets slower as the table grows. Could we load the customers in one query and map them?
That is actionable and about the code. Compare with "this is wrong", which is not.
Mark severity so the author knows what blocks the merge: a nit, a suggestion, or a blocker. Without that, everything reads as equally serious and the author either fixes all of it or none.
Small pull requests
A review of forty lines is careful. A review of a thousand is a rubber stamp. If a change is too big to review properly, the most useful comment is to ask for it to be split.