3 ms·
I would be happy with 100% tabs or 100% spaces, but in practice it seems like allowing tabs inevitably leads to source files indented with a combination of both
by mwfunk 10y ago
I would be happy with 100% tabs or 100% spaces, but in practice it seems like allowing tabs inevitably leads to source files indented with a combination of both, either by accident or because someone wants to have intermediate levels of indentation (for multiline conditionals for example).
Once you have mixed tabs and spaces, everything goes to hell because now that code's formatting is tied to a specific person's idea of how many spaces should a tab display as, or whether tabs refer to tab stops or just a fixed number of spaces.
I never had strong feelings about it until encountering some really pathological code bases, which had gotten to the point where there was literally no valid tab->spaces setting that would make everything look correct.
Ultimately, though, these things really just don't matter. I use 4 spaces per indent level, but it's not like I'm incapable of reading and writing code that uses tabs, or 2 spaces, or 8 spaces. Really the only thing that matters is that there is a standard and that it is consistently applied within a project.
- etwigg 10y agohttps://github.com/diffplug/spotless https://github.com/diffplug/spotless