How should you review code?
Approve a change when it clearly improves the overall health of the codebase, even if it is not perfect. Look for correctness, readability and consistency, and use comments to teach. That is the core of Google's published code review standard.
Last updated November 2026
When should a reviewer approve a change?
Approve when the change definitely improves the overall code health of the codebase, even if it is not perfect. Google's engineering practices documentation sets this as the standard, and says there is no such thing as perfect code, only better code [1]. Reviewers should seek continuous improvement rather than perfection.
Analysis: this rule protects both sides. Authors are not held hostage to a reviewer's ideal version, and reviewers have a clear test: is the codebase better with this change than without it?
Why does code review matter so much?
Review stops slow decline. Google's standard notes that codebases degrade through small decreases in code health, especially when teams are under time pressure, and that reviewers should make sure overall code health does not decrease over time [1].
The same guidance says review is also a way to teach developers [1].
What should you look for in a review?
Check that the code does what it claims, that a stranger could read it, and that it fits the codebase. The checklist below is our own working list; the readability and consistency items rest on PEP 8's principles [2].
| Area | Question to ask | Basis |
|---|---|---|
| Purpose | Does the change do what its description says? | Our advice |
| Correctness | Are edge cases handled: empty input, errors, limits? | Our advice |
| Code health | Is the codebase better with this change? | Google standard [1] |
| Readability | Could someone new understand it without asking? | PEP 8 [2] |
| Consistency | Does it match the module and project style? | PEP 8 [2] |
| Tests | Is there a test, or a clear reason there is none? | Our advice |
| Security | Any secrets, unchecked input or risky dependencies? | NIST SSDF [3] |
For security practices in more depth, NIST's Secure Software Development Framework (SP 800-218, SSDF 1.1) is a set of practices for reducing software vulnerabilities [3].
How do you write useful review comments?
Make each comment specific, explain why, and say how much it matters. Our advice is to label comments so the author knows what blocks approval and what does not. This fits the teaching role the Google standard describes [1].
- Point to the exact line and describe the problem, not the person.
- Explain the reason: "this name hides that it is in seconds".
- Mark optional polish as optional, for example with "Nit:".
- Suggest a fix when you have one; ask a question when you are unsure.
- Say what is good, too. It tells the author what to keep doing.
How should you prepare your own code for review?
Make the change easy to review: small, focused and explained. In our experience, a reviewer reads a short, single-purpose change carefully and skims a long one. Before you request review, run through this list.
- Reread your own diff as if someone else wrote it.
- Remove debug prints and commented-out code.
- Keep style fixes separate from behavior changes.
- Write a description: what changed, why, and how you tested it.
- Run the formatter or linter your project uses.
Common mistakes
- Blocking for perfection. The standard is better, not perfect [1].
- Rubber-stamping under deadline. Time pressure is when small declines slip in [1].
- Arguing personal taste. If the project or style guide does not decide it, let the author choose.
- Unexplained comments. "Change this" teaches nothing; say why.
- Huge changes. Split large work into steps a reviewer can follow.
Summary
- Approve changes that clearly improve code health, even if imperfect.
- Guard against small, repeated declines in quality.
- Review for purpose, correctness, readability, consistency, tests and security.
- Write specific comments with reasons, and label optional ones.
- Use review to teach, and to learn.
Related: programming best practices.
Sources
- Google Engineering Practices, The Standard of Code Review (undated)
- Python Software Foundation, PEP 8: Style Guide for Python Code (2001-07, viewed 2026-11)
- NIST Computer Security Resource Center, Secure Software Development Framework (2026-10)