What is a Code Review? A Guide to Quality Software

What is a Code Review

Table of content

Shipping fast is easy to measure. Shipping code that still works a year later is harder, and that is the job of review. So what is a code review in practice, how should your team run one, and where do the new AI reviewers fit?

What Is a Code Review? The Core Principles of a Code Review Process

A code review is a systematic examination of source code by developers other than its author, done before the change is merged. The reviewer looks for defects, checks that the change does what the ticket asked for, and makes sure the next person can read and maintain it.

The code review process lives inside version control. A developer works on a feature or bug fix in a separate branch, then opens a pull request (GitHub, Bitbucket) or a merge request (GitLab). That request is the unit of review: a diff, a description of why the change exists, and a thread where reviewers comment on specific lines.

In a well-run team the flow looks like this:

  1. The author reads their own diff first and writes a description with the ticket link and testing notes.
  2. Continuous integration runs the build, unit tests, linters and a static analysis scan. Nobody spends human attention on a red pipeline.
  3. An AI reviewer, if the team uses one, leaves a first pass of comments.
  4. One or two human reviewers, often assigned from a CODEOWNERS file, approve the change or request changes.
  5. Branch protection rules block the merge until the required approvals and checks pass.

A peer review is a conversation. Reviewers ask questions, explain the reason behind each request and comment on the code rather than the person, so the author learns why the change got better.

Unpacking the Tangible Benefits of Code Review

The first benefit is fewer defects reaching testing and production. The most cited data comes from SmartBear’s study of a Cisco Systems team: a review of 200 to 400 lines over 60 to 90 minutes should find 70 to 90% of the defects in that code. Above roughly 500 lines per hour, the share of defects reviewers find drops sharply.

The second is shared knowledge. When a senior developer reviews a junior developer’s pull request, the junior learns the patterns the team relies on: how errors are handled, where validation lives, which abstractions to avoid. Reviewing a colleague’s code is the cheapest way for a senior to learn a part of the system they did not write, and explaining a request in writing makes them check their own reasoning. This is what prevents knowledge silos.

The third is consistency. Naming, error handling and module boundaries stay uniform when every change passes a second pair of eyes. Our position: let formatters and linters (Prettier, ESLint, Black or gofmt, depending on your stack) enforce style, and keep human review for decisions a tool cannot judge. A debate about brace placement wastes the most expensive attention you have.

The last is cost. A defect caught in review usually takes minutes to fix, because the author still has the context in their head. The same defect found by a customer means a support ticket, diagnosis, a hotfix and a new deployment, plus damage to your reputation. Shortcuts that pass review today also become the technical debt you have to pay down later.

Code Review Best Practices and Essential Tools

The code review best practices that pay off most concern size and speed. Keep pull requests under about 400 changed lines, and closer to 200 when you can. Split a bigger feature into a chain of smaller changes that each build and pass tests on their own. Google’s engineering practices guide sets one business day as the maximum time to respond to a review request. Slow first responses are what push developers to batch work into giant pull requests.

A code review checklist keeps reviewers consistent. A practical one covers:

  • Functionality: Does the code do what the ticket asks and handle edge cases such as empty input, nulls, time zones and retries?
  • Tests: Would at least one test fail without this change? Are the risky paths covered?
  • Readability: Can another developer follow the change without asking the author?
  • Security: Is user input validated and are queries parameterized against SQL injection? Do secrets stay out of code and logs?
  • Performance: Are there N+1 database queries, unbounded loops or missing pagination?
  • Maintainability: Does the change respect existing module boundaries and stay easy to extend or remove?

Label your comments so the author knows what blocks the merge: “blocking:” for a defect or broken requirement, “nit:” for a preference the author may ignore. Approve with nits rather than holding a change back over a variable name.

Most teams review inside their code host. GitHub, GitLab and Bitbucket all support line-by-line comments, suggested changes, required approvals and code owners. These code review tools connect to CI, so a failing test or a finding from a static analyzer such as SonarQube or Qlty (formerly Code Climate Quality) shows up in the same pull request.

AI Code Review Tools in 2026

The code review AI options teams ask us about most, as of October 2026:

  • GitHub Copilot code review: request Copilot as a reviewer, or set a ruleset so it reviews every pull request. It reads guidance from files such as .github/copilot-instructions.md and AGENTS.md. By default its review does not count toward required approvals, and the Copilot Free plan does not include it.
  • Cursor Bugbot: reviews pull requests on GitHub, GitLab, Bitbucket and Azure DevOps, follows rules in .cursor/BUGBOT.md, and with Autofix can hand a finding to a cloud agent that pushes a fix. Billing is per review usage, not per seat.
  • CodeRabbit: reviews pull requests on the same four platforms and adds IDE extensions and a CLI for a review before you commit.
  • Claude Code Review: Anthropic’s service for Team and Enterprise plans on GitHub. Several agents read the change in parallel, a verification step filters out false positives, and findings arrive as inline comments ranked by severity. It never approves or blocks a pull request.

These tools are good at what tired humans skim past: a missing null check, an unescaped query, a retry loop that never ends. They are weak at the purpose of a change, such as whether a pricing rule matches what sales agreed. GitHub and Anthropic both say in their documentation that an AI review can miss issues. We treat an AI reviewer as a first pass and keep a human approval as the merge requirement. The more code your team writes with AI assistants or through vibe coding, the more review becomes your main quality gate.

Code Review Metrics Worth Tracking

Four numbers show whether the process works. Time to first review tells you whether authors wait; past one business day, they start batching changes, which shows up in median pull request size. Review cycle time, from opening to merge, feeds change lead time, one of the DORA software delivery metrics. Escaped defects, bugs found in QA or production that a reviewer could have caught, connect to change fail rate, another DORA metric.

For AI reviewers, track the share of comments your team acts on. GitHub now lets you resolve a Copilot comment as Addressed, Won’t fix or Incorrect, which gives you that number directly. Avoid proxies such as comments per reviewer, which rewards nitpicking.

How to do Code Review: A Practical Example

Here is a code review example from a typical e-commerce change. A developer writes a function that applies a promotional discount to a shopping cart and splits it across line items, so partial refunds stay accurate. They open a merge request.

The AI reviewer comments first: prices are stored as floating-point numbers, so after the split the line items may miss the order total by a cent. It suggests integer cents, and the author agrees.

The human reviewer then works through the checklist. Each line’s share is its price divided by the cart total, and when the cart holds only free items the total is zero, so the split divides by zero. She marks that comment as blocking and suggests an early return for a zero total, with a unit test. A variable named “d” gets a nit: “discountPercentage” says what it holds. Formatting never comes up, because the linter already fixed it.

The most useful comment is one no tool raised. The ticket says promotional codes must not stack with the loyalty discount, and nothing in the code checks for that. Only someone who knows the requirement catches this kind of business logic gap.

After the author pushes fixes to the same branch, the reviewer checks only the new commits and approves once the tests are green. The change merges into the main code base, and the regression test suite runs against it the same afternoon. Specific comments with a clear severity, then a quick second pass: that is how to do code review well.

Conclusion

A code review is the last point where someone who did not write a change can stop a defect, a security hole or a wrong business rule before your users meet it. Keep pull requests small, answer within a day, use a checklist, and let tools handle style and the first bug hunt. A healthy code review process shows in two numbers: time to first review and escaped defects.

Some businesses hire a code reviews company for an independent audit, typically before an acquisition or when taking over a codebase from another vendor. That gives you a snapshot of risk, but the daily habit of review inside the team keeps quality steady.

Diatom has built software since 2004, and in our AI-first custom software development every AI output is reviewed by a senior engineer before it merges. If you are looking for a development partner who treats review as part of every delivery, let’s talk. Contact us to discuss your project.

Custom Software Development

Have a project in mind?

Internal tools, customer-facing platforms and integrations built around how your business works.