Skip to main content
Team Processes

Code Review: The Human and the Machine, and Why You Need Both

Humans miss bugs but catch design flaws. Bots catch bugs but miss the big picture. The trick is letting each do what they're good at.

It's Friday, 4:57 PM. You've just pushed a 400-line pull request that touches authentication, a database migration, and a new API endpoint. You ping your teammate for a review, hoping to merge before the weekend. The next morning, you see a single comment: "LGTM, but can you fix the typo in the function name?" You fix it, merge, and go back to your coffee. That's the coach. Now imagine the same PR, but this time, a bot scans it, flags a SQL injection vulnerability, and blocks the merge until you fix it. That's the gatekeeper.

Most teams I talk to treat code review as either a human ritual or an automated gate. They pick one. They shouldn't. The data from Google's own engineering practices and the tools we have today make it clear: the best teams use both, but they assign them different jobs.

The Two Camps: Human Review and Automated Gates

The human side is what most of us think of as code review. It's informal, tool-based, and asynchronous (Modern Code Review: A Case Study at Google). The reviewer reads the diff, leaves comments, and approves or requests changes. The automated side is everything from linters to static analyzers to branch protection rules that block merges unless certain conditions are met. SonarQube calls this 'quality gates' — a set of conditions that code must pass before it's released (SonarQube Server Docs - Understanding quality gates).

Criterion 1: Bug Detection

Here's the uncomfortable truth: humans are lousy at finding bugs in review. Google's own research, which looked at 9 million changes over two and a half years, found that fewer than 25% of changes had more than one reviewer, and the primary expectations of review were education, maintaining norms, gatekeeping, and accident prevention — not bug finding (Modern Code Review: A Case Study at Google). In fact, the study explicitly lists 'finding bugs' as not the primary focus. Meanwhile, tools like gosec can scan the Go AST and SSA representation to detect SQL injection, command injection, and path traversal (gosec). Bandit does the same for Python by building an AST and running plugins (Bandit). These tools don't get tired, don't skim, and don't miss a line because it's Friday.

So when it comes to catching security vulnerabilities like the OWASP Top 10 — broken access control, injection, and cryptographic failures — automated tools win hands down. That's not a judgment on human reviewers; it's a division of labor.

Criterion 2: Design and Maintainability

But code review isn't just about bugs. Google's engineering practices say the most important thing to cover in a review is the overall design of the change, not the functionality or the naming (Google Engineering Practices - What to look for in a code review). No linter can tell you that your abstraction is over-engineered or that your data model is going to make the next feature a nightmare. Only a human can. SonarQube's metrics like cognitive complexity and maintainability index try to approximate this, but they can't judge whether a design fits the team's long-term goals. This is the coach's domain. A good reviewer asks 'why did you choose this approach?' and suggests a simpler alternative. That's education, and it's a huge part of why Google's developers find review valuable.

Criterion 3: Speed and Impact on Team Flow

Here's where the gatekeeper can become a bottleneck if you're not careful. Google sets a hard rule: a review should get a response within one business day (Google Engineering Practices - Speed of Code Reviews). Their research shows the median time to first feedback for small changes is under an hour, and the overall median review latency is under four hours (Modern Code Review: A Case Study at Google). That's fast because they keep changes small — the median change size is about 24 lines, and over 35% touch just one file. Automated gates can be just as fast, if not faster. A quality gate on SonarQube can block a merge if new code has less than 80% test coverage or more than 3% duplication (SonarQube Server Docs - Understanding quality gates). That's instantaneous feedback.

But if you require a human to approve every PR and you also require a gate to pass, you can double the latency. The key is to let the gate run first, so the human only sees code that already passes the mechanical checks.

Criterion 4: Team Culture and Learning

The gatekeeper is a machine; it has no feelings. The coach is human, and that's both a strength and a weakness. Google's golden rule is to critique the code, not the author (Google Engineering Practices - code review). That's a human skill. If you rely solely on automated gates, you lose that teaching moment. If you rely solely on humans, you risk burnout and inconsistency. The best teams I've seen use a hybrid: the bot blocks the obvious stuff, and the human spends their energy on design, clarity, and mentoring.

The Hybrid Model: What I Recommend

Here's my specific advice, and it's not a middle ground — it's a clear assignment of roles. Use automated quality gates as your first line of defense. Set up a SonarQube quality gate that checks for new issues, security hotspots, test coverage, and duplication (SonarQube Server Docs - Understanding quality gates). Use branch protection on GitHub that requires status checks to pass and dismisses stale approvals when new commits change the diff (GitHub Docs - About protected branches). And use tools like gosec, Bandit, or Semgrep to scan for security vulnerabilities before a human ever looks at the code.

Then, let humans do what they're good at: reviewing the design, the logic, and the maintainability. Keep PRs small — Google says 100 lines is reasonable, 1000 is too large (Google Engineering Practices - Small CLs). And when you do leave comments, label them by severity (Google Engineering Practices - code review). If it's a nit, don't block the merge — Google's 'LGTM with comments' approach lets you approve while leaving minor suggestions (Google Engineering Practices - Speed of Code Reviews).

I've seen teams adopt this hybrid and cut their review time from days to hours while actually improving code quality. The gatekeeper catches the typos and the SQL injection; the coach catches the over-engineered abstraction. Both are essential.

Comparison Table: Gatekeeper vs. Coach

CriterionGatekeeper (Automated)Coach (Human Review)
Bug/security detectionDetects known patterns (e.g., SQLi, path traversal) reliably (gosec).Less effective; Google's study shows finding bugs is not a primary goal.
Design reviewLimited to complexity metrics (SonarQube).Essential for design feedback and education (Google Engineering Practices).
SpeedInstant feedback, can block merges in CI (SonarQube).Must respond within 1 business day (Google Engineering Practices).
Team cultureImpersonal, no teaching.Teaches norms and golden rule (Google Engineering Practices).

Who Should Use Which?

If you're a solo developer or a tiny startup, you might get away with just a linter and a quick glance from a teammate. But if you're building a product that handles user data, you have no excuse not to run a security scanner like gosec or Bandit. If you're on a team of five or more, you need both. The gatekeeper scales; the coach doesn't. You can't have a human review every line of a monorepo, but you can have a bot scan it all day.

That said, the gatekeeper is not a substitute for the coach. I've seen teams that rely entirely on automated tools, and their code is safe but soulless — no one learns anything, and the design rots. I've seen teams that rely entirely on humans, and they miss critical vulnerabilities because no one remembers to check for path traversal. The answer is to give the gatekeeper the mechanical checks and the coach the judgment calls.

Bottom Line

Stop arguing about which one wins. Adopt the hybrid: let the gatekeeper block the obvious, and let the coach guide the design. Set up a quality gate with SonarQube, add a security scanner, and then give your human reviewers the time to do the deep thinking. That's the only way to get both speed and quality.

Sources

  • Google Engineering Practices - code review - https://google.github.io/eng-practices/review/
  • SonarQube Server Docs - Understanding quality gates - https://docs.sonarsource.com/sonarqube-server/2026.1/quality-standards-administration/managing-quality-gates/introduction-to-quality-gates
  • Modern Code Review: A Case Study at Google - https://www.papercache.org/papers/mlsys/system/2026/03/25/modern-code-review-a-case-study-at-google
  • gosec - Go Security Checker - https://raw.githubusercontent.com/securego/gosec/master/README.md
  • Bandit (PyCQA) Docs - https://bandit.readthedocs.io/en/latest/
  • Google Engineering Practices - Speed of Code Reviews - https://google.github.io/eng-practices/review/reviewer/speed.html

Share this article:

Comments (0)

No comments yet. Be the first to comment!