Join our Newsletter — 33% off our NHI Course

What are the signs that a non-empty statement is failing to do real work in a code review?

The clearest signs are expressions that evaluate without assignment, return, branching, looping, or a side effect. Watch for property references that are not invoked, comparison operators used in place of assignment, and callback bodies that end without returning a value. If a line can run and still leave program state unchanged, it deserves scrutiny.

How to spot a non-working statement in a review

A non-empty statement often looks busy while doing nothing. The key test is whether it changes state, drives control flow, or produces an observable effect. If the expression is evaluated and then discarded, the code may be syntactically valid but functionally inert, which is exactly why this pattern deserves close review.

Property access without invocation, equality used where assignment was intended, and callback bodies that never return are all common ways this happens. Each pattern leaves the line looking purposeful while failing to move data, branch logic, or call the intended operation.

In practice, the strongest signal is not that a line is non-empty, but that nothing downstream can depend on it. When the result is unused and the surrounding code behaves identically with the line removed, the statement is not doing real work.

What failure patterns usually hide the problem?

The easiest mistakes to miss are the ones that resemble legitimate coding style. A standalone property reference can suggest inspection, but if it is not consumed, it has no effect. A comparison operator in place of assignment may pass a quick visual scan. A lambda or callback may compile cleanly while silently returning nothing useful.

These failures matter because they create false confidence in review. The code appears intentional, but the program state never changes, so the reviewer must look for the absence of assignment, return, branching, mutation, or side effects rather than the presence of a line of code.

That makes context essential. A statement only counts as doing work if the language semantics allow an observable outcome that is actually exercised. If a line is merely evaluated, documented, or tolerated by the parser, it should be treated as suspicious until its effect is clear.

What should a reviewer verify before approving it?

Review the statement against the behavior it is supposed to cause, not just its syntax. Ask what variable, object, return path, or external action should change because of that line, then confirm that the change is really observable in the control flow or result path.

If the line is meant to call something, confirm it is invoked. If it is meant to assign, confirm the target is actually updated. If it is meant to filter, branch, or transform, confirm the resulting path differs in a way the program later depends on.

When the intent is unclear, the safest response is to require the author to make the effect explicit. Review is not only about catching bugs after the fact, but about forcing a statement to prove that it contributes to program behavior.

Practitioner Guidance

What to prioritise: Treat “looks meaningful but leaves no trace” as a review smell. The fastest way to confirm it is to trace whether the line affects state, return values, control flow, or an external side effect that later code can observe.

What to verify: Check the exact language semantics for expressions that are easy to misread, especially property access, accidental comparison, and callbacks with implicit returns. If removing the line produces the same behavior, it is probably dead or mistaken code.

Common mistake: Reviewers often focus on whether a line is syntactically valid or stylistically common, then miss that it does nothing at runtime. The important question is whether any execution path depends on its result.

Practitioner takeaway: A statement is only real work if it changes something the program later relies on; if it cannot alter state, flow, or output, it should be challenged as dead weight.