Code Review Is Teaching and Learning
Code review is not gatekeeping — it is a collaborative practice that improves code quality, shares knowledge, and catches bugs before they reach production. Effective teams review code quickly, give constructive feedback, and treat reviews as a learning opportunity for both author and reviewer. At Nexis Limited, every code change is peer-reviewed before merging.
What to Look For
Correctness
Does the code do what it is supposed to do? Verify the logic against the requirements. Check edge cases — empty inputs, null values, boundary conditions, concurrent access. Look for off-by-one errors, incorrect comparison operators, and missing error handling.
Design and Architecture
Does the change follow established patterns? Is the abstraction level appropriate? Are new concepts introduced consistently with existing architecture? Is the change in the right place in the codebase, or does it create inappropriate coupling?
Readability
Can another engineer understand the code without the author's explanation? Are variables and functions named clearly? Are complex logic sections commented? Is the code organized logically?
Testing
Are there tests for new functionality? Do tests cover edge cases? Are tests readable and maintainable? Would a test failure clearly indicate what broke?
Security
Review for injection vulnerabilities, improper authentication or authorization checks, exposure of sensitive data in logs or error messages, and insecure direct object references.
Giving Feedback
Be Specific and Constructive
Instead of "this is wrong," explain what the issue is and why it matters. Instead of "rename this," explain what a better name would be and why. Provide code suggestions when possible.
Distinguish Severity
Not all feedback is equally important. Distinguish between:
- Must fix: Bugs, security issues, data integrity problems. Block merge.
- Should fix: Significant improvements to design, readability, or performance. Discuss with the author.
- Nit: Style preferences, minor refactoring suggestions. Optional. Prefix with "nit:" so the author knows it is low priority.
Praise Good Work
Acknowledge clever solutions, clean code, thorough testing, and good documentation. Positive feedback is as important as critical feedback for team morale and motivation.
Review Speed
Review speed matters. A PR waiting for review blocks the author from moving forward and delays feature delivery. Aim to respond to review requests within 4 business hours. If a thorough review will take time, post an initial comment acknowledging the PR and estimating when you will review completely.
Author Responsibilities
- Keep PRs small: Review quality drops dramatically for PRs over 400 lines. Break large changes into logical, reviewable chunks.
- Write PR descriptions: Explain what changed, why, and how to test. Link to relevant issues or design documents.
- Self-review before requesting review: Read through your own changes first. Catch obvious issues before a colleague's time is spent.
- Respond to feedback promptly: Address all comments — fix issues or explain your reasoning. Do not leave comments unresolved.
Automation
Automate what can be automated so human reviewers focus on design and logic:
- Linting and formatting — enforce style automatically with ESLint, Prettier, or similar tools.
- Type checking — catch type errors with TypeScript or MyPy in CI.
- Test execution — run the test suite automatically on every PR.
- Security scanning — automated dependency and code security scanning.
Conclusion
Code review is a skill that improves with practice. Give specific, constructive feedback. Review promptly. Keep PRs small. Automate style enforcement. Treat every review as a teaching and learning opportunity that makes the team stronger.
Building engineering culture? Our team can help establish effective development practices.