Code review is the process of checking source code by one or more developers before merging it into the main project branch. In the context of Git and platforms like GitHub, GitLab, or Bitbucket, code review is implemented via pull request: the author creates a PR, assigns reviewers, and they review the changes, leaving comments and change requests. According to Google Engineering Practices (2026), code review improves code quality, spreads knowledge across the team, and reduces the number of defects in production. Good review is not control, but collaboration in the form of a developmental dialogue.
Key Takeaways
Code review is a systematic check of code by colleagues before integration. In the Git context, this means: a developer creates a pull request with changes, assigns reviewers, and they study the diff, leave comments, and make a verdict. A reviewer can request changes, approve the PR, or leave a general comment.
Code review pursues five goals: improving code quality (finding defects before they reach production), spreading knowledge (the reviewer learns about new approaches, the author receives feedback), ensuring standards (checking compliance with code style and architectural decisions), reducing bus factor (more than one developer knows the code), and building a culture of responsibility (the author writes more carefully knowing the code will be reviewed).
The opposite of code review is a blind commit: a developer pushes changes to a shared branch without review. This approach is acceptable only in single-developer projects or for urgent hotfixes with subsequent post-factum review. In professional team development, code review is a mandatory step for any change, including documentation and configuration updates.
Code review should be systematic, not chaotic. Experienced reviewers check code in a specific order: first architecture and logic, then tests, then security and performance, and only at the end — style and naming. This order ensures critical issues are noticed before the reviewer gets tired.
Architecture and logic: does the code solve the task, are there excessive abstractions, are SOLID and DRY principles followed. Complex code that is hard to understand on first reading is a signal that refactoring is needed. The reviewer should ensure that the code does exactly what the task specifies and has no side effects beyond its responsibility.
Tests: do the new tests cover all scenarios — positive, negative, edge cases. Do existing tests pass after changes. Are there any flaky tests that fail inconsistently. Security: absence of SQL injections, XSS, sensitive data leaks through logs or API responses. Performance: algorithm efficiency, excessive database queries, resource leaks.
PR size limit is the most important metric of code review effectiveness. A Cisco study (2015) and subsequent experiments by SmartBear and Google showed that when the review volume exceeds 400 lines, the reviewer’s ability to find defects drops sharply. If a PR exceeds 400 lines, defects are detected with no more than random probability.
Optimal size: 200–400 lines per PR. This volume can be reviewed in 30–60 minutes while maintaining concentration. Google recommends no more than 200 lines per review round with full concentration. If changes are larger, the task should be decomposed into several sequential PRs, each introducing a logically complete change.
Review time: within 24 hours from PR creation. If the review drags on for several days, task context is lost, and the author has to spend time restoring context when responding to comments. Teams with a strong code review culture set SLAs on review: for example, 4 hours for critical changes and 24 hours for regular ones.
| PR Size | Review Time | Effectiveness |
|---|---|---|
| Up to 200 lines | 15–30 minutes | High — up to 90% of defects |
| 200–400 lines | 30–60 minutes | Medium — up to 70% of defects |
| 400–1000 lines | 1–3 hours | Low — less than 40% of defects |
| Over 1000 lines | 3+ hours | Critically low — ~10% of defects |
Comment tone is critically important for code review effectiveness. A comment like “This is wrong” triggers a defensive reaction and doesn’t provide useful information to the author. A better formulation is a question-suggestion: “What do you think about this approach?”, “This could cause an NPE if user == nil. Maybe add a guard?”. Questions are less confrontational and stimulate discussion.
A good comment structure includes three parts: what’s wrong, why it’s a problem, and how to fix it. Example: “This loop uses O(n²) due to nested contains, which could be slow with 10k+ records. Try replacing with a Set for O(1) lookup.” This formulation simultaneously identifies the problem, explains its importance, and suggests a solution — the author doesn’t have to guess.
GitHub and GitLab support suggestions — inline code change proposals. A reviewer can write: “```suggestion Filter empty strings before processing```” and the author can apply the change with one click. This speeds up minor fixes and reduces the number of review rounds. For major changes, it’s better to write a general comment rather than embedding large blocks in a suggestion.
# Template for good code review comment
# BAD: "This code is wrong"
# GOOD: "We may lose data on empty response.
# If response.data == nil, the guard returns nil,
# and user sees empty screen without error.
# Maybe add a fallback error message?"
# GitHub suggestion syntax:
# ```suggestion
# let result = try? parse(response, fallback: .defaultValue)
# ```
An effective review workflow is built on four stages. First — the author prepares the PR: writes a clear title (e.g., “feat: add password reset screen”), adds a description of changes, links to the task in the tracker, and testing instructions. Second — the author assigns reviewers via auto-assign (based on CODEOWNERS) or manually.
The third stage — the reviewer checks the code and leaves comments. The fourth — the author makes corrections, responds to comments, and requests a re-review. The cycle repeats until approval is received. After approval, the author performs the merge (or the bot does it). Automation via Mergify or GitHub Auto-merge speeds up the final stage.
An important workflow element is stale PR management. If a PR sits without review for more than 3 days, the process is blocked. Solutions: reviewer rotation (if the assigned reviewer is unavailable), notifications via Slack/Teams, review time limit (SLA). In some teams, a PR without review for more than 7 days is automatically closed, and the author creates a new one after syncing with main.
The first mistake — superficial review. The reviewer quickly scans the diff without diving into the logic and clicks Approve. Causes: large PR, deadline, fatigue. Consequences: bugs reach production. Solution: if there’s no time for a quality review — honestly write “I can’t review today, move it to tomorrow” instead of a formal approval.
The second mistake — excessive criticism (nitpicking). The reviewer leaves dozens of comments about formatting style, variable naming, trivial details. This demotivates the author and drags out the review. Solution: StyleGuide and linters should check style automatically. A human in review checks logic, architecture, and security.
The third mistake — review without questions. If the reviewer only posts Request Changes and Approve but doesn’t ask questions, they miss the opportunity to learn something new. The best indicator of a healthy code review is the presence of discussions in which both sides learn something new. If a review is a monologue by one participant, the process is broken.
Frequently Asked Questions
To review code means to conduct a code review of a pull request: check changes for compliance with quality standards, find potential errors, evaluate the architecture, and leave constructive comments. After a successful review, the reviewer approves the PR, allowing merging into the target branch.
200–400 lines is the optimal volume for a single PR. Research by Cisco (2015) and Google shows that with larger volumes, defect detection effectiveness drops sharply. If there are more changes, the task should be decomposed into several logically complete PRs, each no more than 400 lines.
In order of priority: architecture (is the right solution chosen), logic (correctness, error handling, edge cases), tests (coverage of new scenarios), security (injections, data leaks), and performance. Leave style and formatting to linters.
Constructive and respectful. Instead of “This is wrong” — “What do you think about this approach?”. Instead of statements — questions. Explain why a particular solution is problematic, not just point to it. Code review is a dialogue between colleagues, not an exam.
The recommended time is within 24 hours. For critical changes — up to 4 hours. If the reviewer doesn’t respond longer, contact the team lead for reassignment. Long review waits slow down development and force the author to switch to other tasks, losing context.
Summary
We will develop a mobile application turnkey
IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.
Read also