Skip to content
Technical Judgment

Take Style Debates Out of Code Review

A reviewer asking for two-space indentation is doing a machine's job badly. Decide the style once, encode it in the repository, and spend the review on what the code does.

Technical JudgmentEngineering Management Academy5 min read

Open the diff of a pull request that reformatted a file. Three hundred lines changed, of which eleven matter. The reviewer cannot find them, so they approve on trust or ask for the formatting to be reverted, and either way the afternoon is gone. Somewhere else in the same repository a Windows laptop has introduced CRLF line endings, and the next engineer to open the file on a Mac will commit a change to every line.

There is no engineering difficulty in any of this. It is a decision nobody has made, and making it is the manager's job.

What the tooling does

Seth Falco's introduction to EditorConfig on freeCodeCamp describes the mechanism. A .editorconfig file at the root of the repository declares the formatting conventions for textual files, in a plain INI-style format, and editors read it. The EditorConfig project describes its purpose as helping "maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs." Visual Studio Code, the JetBrains IDEs, Vim, Emacs, GitHub and GitLab read the file natively; a few other editors need a plugin.

The specification is short. The properties cover indentation style and size, line endings, character set, trailing whitespace and whether a file ends with a newline. Files are read from the target file's directory upwards until one sets root = true, and "the most recent pairs found take precedence", so a repository can set one default and override it for a single directory. Falco's example sets two-space indentation and LF line endings for everything, CRLF for Batch files and four spaces for C# and Java.

That is the whole of it. It settles tabs against spaces, line endings and trailing whitespace, in every editor on the team, without anyone having to remember.

Why a manager should care

Falco gives three reasons, and two of them are management reasons. The first is readability. He quotes Robert C. Martin's estimate that "the ratio of time spent reading versus writing is well over 10 to 1", and inconsistent formatting is a tax on all of that reading. The second is review. In his words, "enforcing formatting should be delegated to software." A human reviewer pointing out an indentation error is doing a machine's job, slowly and with social cost. The third is the experience of the engineer joining a project, who should not have to hunt for a style guide or reconfigure their editor.

We would add a fourth. Style comments are the easiest comments to write, so in a team without tooling they crowd out the hard ones. Google's list of what to look for in a code review places style after design, functionality, complexity, tests and naming, and its standard of code review treats the style guide as the authority on style questions. A team arguing about brace placement in a pull request has not decided whose authority that is.

EditorConfig alone is not enough

EditorConfig handles whitespace and encoding. It says nothing about where a line breaks, how a long argument list wraps or whether a ternary sits on one line. For that you need a formatter, and the clearest argument for an opinionated one comes from the Prettier project's own rationale. The team acknowledges that a shared style guide is valuable and that building one by consensus is "painful and unrewarding". The goal, in their words, is "to free mental threads and end discussions around style."

Their option philosophy is the part a manager should read twice. "By far the biggest reason for adopting Prettier is to stop all the ongoing debates over styles", and the project refuses most new options because "the debates over styles just turn into debates over which Prettier options to use." The option set is now frozen. The lesson generalises beyond JavaScript. Whatever formatter your language has, adopt it with as close to its defaults as you can bear, because every option you expose is a debate you have scheduled.

The same logic applies to linters. A rule the linter enforces is one no reviewer has to mention. A rule the linter cannot express is a candidate for the team's written conventions, and if it cannot be written down it is a preference, and preferences do not block merges.

The decision, and how to make it stick

The sequence we would use has four steps.

Decide the configuration with the team in one meeting, time-boxed, with a bias toward the formatter's defaults. Commit .editorconfig and the formatter configuration to the repository. Run the formatter once over the whole codebase in a single pull request with no other changes in it, so that the big diff happens once and the history stays readable. Then add a check in continuous integration that fails when a file is not formatted, so the rule holds without a reviewer enforcing it.

After that, the manager's role is refusal. Style comes up again when a new engineer arrives with strong views, or when the formatter produces something ugly in one case. The answer is that the decision was made, the cost of reopening it is a week of everyone's attention, and the ugly case is not worth that. If the team wants to change a setting, it is one pull request to the configuration and one reformat, and it needs a reason that outweighs the churn.

One caution. Formatting is the easy part of a coding standard, and it is tempting to feel the standard is done once the formatter is green. The decisions that matter in review, about design, error handling and whether a change belongs at all, are the ones tooling cannot take from you. Clearing the style noise is how you make room for them.

Where this sits in the standard

Code review and quality standards is a competency in the Technical Judgment domain of the EMA Competency Framework. The code review and quality unit covers which standards to automate and which need judgment, and the designing how work flows unit covers removing the friction that slows a team without anyone deciding to.

A scenario question on this might describe a situation in which a team's review threads have become arguments about style, and ask you to decide what to automate and what to settle. See what EMA-I covers.

Filed undercode reviewtoolingcoding standardsengineering management
This sits under Technical Judgment in the Competency FrameworkThe Body of Knowledge chapter covers the full set of competencies the examinations assess in this domain.Read it →

Test your judgment, not your recall.

EMA-I is a scenario-based examination in the five domains of the framework. There is no course to buy and no attendance to prove. Sit a sample first, or read what the credential covers.

Keep reading