When I started leading code reviews a decade ago, I treated them mostly as style checks. Did the code pass linting? Were variable names consistent? Did it follow our formatting guide? That approach felt thorough until a payment service I had approved double-charged customers because I never questioned the retry logic. The code was perfectly formatted. It was also wrong. That incident reshaped how I review code. A useful checklist goes far beyond style and looks for the defects that automated tools cannot see: flawed logic, missing failure handling, weak tests, leaky abstractions, and subtle security gaps. This article is the checklist I now use with teams and teach to new reviewers.
Why Automated Formatters Leave Critical Defects Untouched
In my experience, the fastest way to make reviews more valuable is to stop reviewing what machines can already check. If your team still debates indentation or import order in pull requests, automate it. Tools like ESLint, Prettier, Black, and Checkstyle eliminate style discussions completely, which frees your brain for higher-value questions.
What remains after automation is where human judgment matters. Linters can tell you that a promise is not handled, but they cannot tell you if the promise should exist at all. Type checkers can verify a function receives a string, but they cannot tell you if that string should have been validated as an email, normalized to lowercase, or escaped for SQL. I've found that junior reviewers often assume a green CI pipeline means the code is correct. It only means it is consistent.
Separating Style From Substance in Your Review Workflow
A practical pattern I recommend is a two-pass approach. On the first pass, confirm automation ran: formatter, linter, type checker, and existing tests all passed. If those failed, stop the review and ask the author to fix them. Do not leave comments about spacing that a script could fix. On the second pass, ignore style completely and focus on intent. Read the ticket or product requirement first, then ask: does this change actually solve the stated problem, and does it do so without creating new ones?
This shift sounds small, but it changes the conversation. Instead of "use camelCase here," you start asking "what happens if this array is empty?" One catches a typo, the other prevents an outage.
Interrogating Business Logic for Missing Edge Cases and Off-by-One Errors
Logic errors are the most expensive bugs because they pass all tooling and often pass tests too. When I review business logic, I reconstruct the requirements in my head and hunt for the inputs the author did not consider.
Common places where logic fails include boundary conditions, empty collections, time and timezone handling, and pagination. I once reviewed an inventory service that correctly decremented stock but never checked if the decrement would make the quantity negative. The unit test used a starting quantity of 10 and purchased 2 items, so it passed. In production, a bulk order of 20 against a stock of 5 went through and left the database in an inconsistent state.
Concrete Questions to Ask About Every Conditional and Loop
For every conditional, ask about the missing branch. If the code says if (user.isVerified), what should happen when the user is not verified? Is the else path explicit, or does the code silently continue with incomplete data? For loops and slicing, verify the boundaries with a concrete example in your head. Test with zero, one, many, and especially with the maximum allowed value.
Pay close attention to date logic and monetary calculations. Never assume timestamps are in the same timezone or that floating point math is safe for currency. If you see date parsing without an explicit timezone or money stored as float, flag it.
// Review this carefully: what happens on edge cases?
function getDiscountedPrice(price, discountPercent, user) {
// Bug 1: no validation that discountPercent is within 0-100
// Bug 2: price as float can cause rounding errors for currency
// Bug 3: what if user is null or user.tier is unexpected?
if (user.tier === 'premium') {
discountPercent += 10;
}
return price * (1 - discountPercent / 100);
}
// Safer version to suggest in review:
function getDiscountedPriceFixed({ priceCents, discountPercent, user }) {
if (discountPercent < 0 || discountPercent > 100) {
throw new RangeError('discountPercent must be 0-100');
}
const tierBonus = user?.tier === 'premium' ? 10 : 0;
const totalDiscount = Math.min(discountPercent + tierBonus, 100);
// Work in integer cents to avoid float errors
return Math.round(priceCents * (1 - totalDiscount / 100));
}
The second version is longer, but it makes its assumptions visible and fails fast on invalid input. During a review, I would also ask whether the discount cap at 100% is the intended business rule and whether priceCents should be validated as a non-negative integer.
Tracing Error Paths and Resource Lifecycles Under Failure
Most code is written for the happy path. Mature reviewers spend most of their time on the unhappy paths. I trace every external call — database, HTTP request, file system, queue — and ask what happens when it throws, times out, or returns malformed data.
Two anti-patterns show up constantly. The first is catching an exception too broadly and suppressing it. The second is acquiring a resource without guaranteeing its release. Both are easy to miss if you only skim the main flow.
# Python example: subtle resource leak and swallowed exception
def process_report(path):
f = open(path, 'r')
data = f.read()
result = call_external_api(data) # may raise TimeoutError
f.close() # never reached if exception occurs above
return result
# What to suggest:
from contextlib import contextmanager
def process_report_fixed(path):
# Context managers guarantee cleanup per Python docs:
# https://docs.python.org/3/reference/datamodel.html#context-managers
try:
with open(path, 'r') as f:
data = f.read()
result = call_external_api(data)
except TimeoutError as e:
# Log with context, don't swallow. Let caller decide retry policy.
logger.warning("external api timeout for %s", path, exc_info=e)
raise
return result
In the fixed version, with ensures the file is closed even if call_external_api fails, which is the correct use of context managers as described in the Python Documentation. The exception is logged with context and re-raised instead of being hidden. When reviewing JavaScript or TypeScript, I apply the same principle to fetch calls. The MDN Web Docs on the Fetch API remind us that fetch only rejects on network failure, not on HTTP error status, so you must check response.ok explicitly. I always flag fetch code that does not handle 4xx and 5xx.
Checklist for Failure Handling
Look for retries without backoff or idempotency keys, which can amplify failures into outages. Check that timeouts are set — missing timeouts are a classic cause of cascading failures. Verify that user-facing error messages do not leak internal details like stack traces or SQL, while logs do contain enough context to debug. In my experience, the best reviews explicitly ask: if this dependency is down for five minutes, what does the user see, and do we recover automatically when it returns?
Judging Whether Tests Actually Prove Correctness
A pull request with tests is not the same as a pull request with good tests. I have seen changes with 90% coverage that proved almost nothing, and small changes with two thoughtful tests that caught real regressions.
When I review tests, I ignore the coverage percentage at first. I read the test names and ask if they describe behavior, not implementation. A test named test_process_works tells me nothing; test_rejects_expired_coupon_at_midnight_utc tells me a requirement is specified and verified. I then look for missing scenarios: the empty case, the error case, the concurrent case, and the case with invalid input that should be rejected.
Be cautious with test doubles. Mocks are necessary but they can also make tests tautological. If a test mocks the database and then asserts that the mock was called, it proves the code called the mock, not that the query is correct. For that reason, I often suggest replacing mocks with fakes or using real dependencies where feasible. If you find yourself mocking heavily, the guide Test Doubles Explained: Mocks, Stubs, Fakes and Spies is a helpful reference for choosing the right double, and for data access code I encourage teams to try Integration Testing with Testcontainers: Real Databases in Your Test Suite to catch the SQL and schema issues that mocks hide.
// Weak test: passes but proves little
test('creates user', () => {
const mockDb = { insert: jest.fn(() => Promise.resolve({ id: 1 })) };
const service = new UserService(mockDb);
return service.create({ email: 'A@EXAMPLE.COM' }).then(result => {
expect(mockDb.insert).toHaveBeenCalled(); // only proves we called insert
});
});
// Stronger test: verifies behavior and normalization
test('normalizes email to lowercase and rejects duplicate', async () => {
const db = new FakeUserStore(); // in-memory fake that enforces uniqueness
const service = new UserService(db);
await service.create({ email: 'A@Example.COM' });
await expect(service.create({ email: 'a@example.com' }))
.rejects.toThrow(/already exists/);
const stored = await db.findByEmail('a@example.com');
expect(stored.email).toBe('a@example.com');
});
The second test exercises real business rules — normalization and uniqueness — without caring how many times insert was called. I also look for assertions that are too loose, such as expect(result).toBeTruthy() when a precise value could be checked, and for tests that never verify error paths. A useful follow-up reading is Mutation Testing: Why 100% Code Coverage Does Not Mean Bug-Free, which shows why high coverage can still miss logic changes that should have broken tests. I have adopted mutation testing on critical modules because it answers the question line coverage cannot: would these tests fail if the code were subtly wrong?
Reviewing Interfaces and Names for Long-Term Maintainability
Code is read far more often than it is written. A review is one of the few moments where you can improve maintainability before an abstraction spreads across the codebase.
I start with names. A good name reveals intent and hides irrelevant detail. If a function is called processData or handleRequest, I ask the author to be more specific about what processing or handling means. If a variable holds a timestamp, its name should state the unit and timezone, like createdAtUtcMillis, not just time. When I see a boolean named flag or data as a variable name, I treat it as a signal that the domain concept has not been clarified.
Next, I examine the interface itself. Does the function have too many parameters? Functions with five or more primitive arguments are prone to swapped arguments at the call site. I suggest bundling related parameters into an options object or a value object. I also check for leaking implementation details: a function that returns a raw database row dict forces callers to know the column names, while returning a well-typed domain object encapsulates change. In my experience, the most maintainable pull requests add few new concepts and reuse existing ones, rather than inventing parallel utilities that do almost the same thing as a current helper.
Signs an Abstraction Will Create Future Cost
Watch for premature abstraction as well. Adding a generic plugin system for two use cases adds indirection without benefit. Conversely, watch for copy-paste code that should have been a shared function — duplication across three places is worth extracting, duplication across two might not be. I ask authors to consider how a new API will evolve: can we add a field without a breaking change? Is the return value extensible? A practical check is to review the callers. If every caller immediately transforms the result, the function is returning the wrong shape.
Detecting Security Anti-Patterns and Silent Data Corruption
Security and data integrity issues rarely look like bugs. They look like convenient shortcuts. Because automated scanners miss business-specific flaws, reviewers become the last line of defense.
For security, I check input validation at the boundary. Every value that comes from a user, a URL, or an external service should be treated as untrusted. Look for SQL, HTML, or shell strings built by concatenation, missing authentication checks on new endpoints, and sensitive data logged in plain text. When handling URLs or redirects, verify that the target is allowlisted rather than taken directly from a query parameter — open redirects are still common.
For data integrity, I trace writes through the system. Is there a transaction where one is needed? What happens if the process crashes halfway through? Are concurrent writes protected by a constraint or by optimistic locking, or do they rely on hope? One subtle bug I caught in review was a payment writer that used two separate updates without a transaction; a retry after the first update created duplicate ledger entries.
| Concern | What Automated Tools Often Catch | What Human Review Must Verify |
|---|---|---|
| Input handling | Type mismatches, basic injection signatures | Business validation, encoding, allowlists, length limits |
| Authentication & authorization | Missing auth middleware signatures | Correct scope, object-level checks, rate limits on new endpoints |
| Data persistence | Syntax errors in queries | Transactional boundaries, idempotency, concurrency controls |
| Error disclosure | Console logging of errors | No sensitive data in responses, structured logs with correlation IDs |
| Dependency management | Known vulnerable versions | Unnecessary new dependencies, supply-chain risk, license compatibility |
I use that comparison to keep the review focused. Tools handle the first column, reviewers own the second. When in doubt, I ask the author to describe the threat model in a comment on the pull request: who can call this, what can they control, and what should happen if they send hostile input. Writing that down often surfaces missing checks before the code merges.
Frequently Asked Questions
How long should a thorough code review take?
For most teams, a focused review of 200 to 400 lines of changed code takes 30 to 60 minutes. Larger pull requests take longer but quality drops sharply as fatigue sets in. In my experience, it is more effective to ask the author to split a 1,000-line change into smaller, self-contained commits and review them in sequence. If a review regularly takes more than an hour, the pull request is likely too large or missing context such as a description, screenshots, or linked requirements.
Should every comment in a code review block the merge?
No. Distinguish between blocking issues and suggestions. I label comments as either “needs fix” for correctness, security, or data-loss risks, or “consider” for naming, structure, or alternative approaches. This keeps discussion efficient and respects the author’s ownership. If you and the author disagree on a non-blocking point, capture it as a follow-up ticket rather than delaying the merge. Blocking only on what would cause bugs, outages, or security issues builds trust and keeps the team moving.
How do I review code in a language or domain I am less familiar with?
Focus on what is language-agnostic: business logic, edge cases, error handling, tests, and interfaces. You can still flag unclear names, missing validation, and inconsistent error responses without being an expert in the stack. Ask questions instead of giving directives, such as “what happens here if this list is empty?” and rely on the author to explain. Pairing the review with documentation checks helps too — verify that the code matches the referenced spec or API contract, and confirm that unknown idioms are covered by existing team style guides or linked references.
What checklist should I actually use during the review?
Keep it short enough to remember. Before approving, I confirm: logic handles empty, invalid, and boundary inputs; every external call has timeout and error handling; resources are acquired and released safely; tests verify behavior rather than implementation and include failure cases; public interfaces are named clearly and will be easy to extend; and inputs are validated and authorization is checked. If any of those cannot be answered from the diff, I ask the author to add a comment or test that makes the answer explicit.