3 ms·
Formatting is NOT the purely stylistic choice many code formatter authors make it out to be, though. It can greatly affect readability, lead to/prevent unneces
by Hendrikto 5y ago
Formatting is NOT the purely stylistic choice many code formatter authors make it out to be, though.
It can greatly affect readability, lead to/prevent unnecessary merge conflicts, and aid in/stand in the way of using nice VCS features (blame, revert, bisect, cherry-pick, …).
Many automatic code formatters ignore and do not optimize for these metrics.
- sixstringtheory 5y agoI’ve never seen a formatter cause merge or blame issues, but that could be because I always have them run on a precommit hook and even then always squash all commits on a PR so there is never a commit in mainline history solely for code format. I would not admit a PR solely for formatting, either. Git history trumps code style IMO, I would not e.g. add a formatter to a legacy codebase and then reformat everything, or do so after changing a rule. Only diffs get formatted.