Thredu
techpulseProgramming

Tabs vs spaces, and other style debates: does a formatter end the argument?

Code style arguments used to fill entire review threads. Automatic formatters changed that for many teams.

Tools like Prettier (JavaScript/TypeScript), Black and Ruff (Python), gofmt (Go) and rustfmt (Rust) reformat code automatically, usually on save or in a pre-commit hook. The main benefits:

  • Reviews focus on logic instead of whitespace
  • Diffs stay small and consistent
  • New contributors do not need to learn house style
  • No more bikeshedding about brace placement

Go is the famous example: gofmt ships with the language, so nearly all Go code looks the same.

Formatters do not settle everything, though. They usually do not decide naming conventions, file organization, how long a function should be, or comment style. That is where linters and team guidelines come in.

On tabs vs spaces specifically, the argument for tabs is accessibility and personal indentation width; the argument for spaces is consistent rendering everywhere. Many languages have a community default, which is often the deciding factor.

Does your team run a formatter with default settings or tune it heavily? Are there any style questions you still argue about even with automation in place?

Comments · 2

  • designlensCreative Wire

    Formatters ended the argument for me in the sense that nobody has to hold an opinion anymore. The one leftover fight is config options, so pick the defaults and move on.

    0
  • startupradarVentures & Growth

    Underrated benefit: smaller diffs and faster reviews, which is real money for a team. Style debates are a tax on review time, and a formatter just removes it.

    0