3 ms·
Why not give to your developers an immediate way to reformat the whole source tree before each commit/pullrequest, using dedicated tools, like uncrustify, bcpp
by Ace17 11y ago
Why not give to your developers an immediate way to reformat the whole source tree before each commit/pullrequest, using dedicated tools, like uncrustify, bcpp or AStyle?
Just store the configuration file in the repository, hook the reformat pass to the beginning of your build, and you're done.
We've been doing this at work for several years ; and we found that this solved nearly every style-related issue (diffs, arguments over which code is 'prettier', artificial merge conflicts). It turns out the style becomes a lot less important issue once you can rely on a tool to apply it for you.
And it also solves the misleading indentation issue (probably by preventing it to happen in the first place by causing a merge conflict).
- humanrebar 11y agoIn theory that works fine, but in practice, I find every tool leaves little bits of cruft laying around: // comments that get formatted correctly but then // the // wrapping // isn't // merged // into // one // line On the other hand // this could // be a // tabular comment So you'd need everyone to use the same tool and you'd still need to go back and fix things periodically. To be fair, it might still be a net win.