5 ms·
Lint to personally preferred style on checkout. Lint to project style on checkin. Not a problem.
by gdfasfklshg4 8y ago
Lint to personally preferred style on checkout. Lint to project style on checkin. Not a problem.
- hyperpape 8y agoDo you actually do this? From what I hear (and this makes sense from what I know about formatting/parsing algorithms) it's a huge pain, and not implemented for many languages.
- emodendroket 8y agoI have my IDE do all the formatting every time I close something and rarely personally intervene.
- hyperpape 8y agoThat's easyish: it's a one-way street. The OP imagined something where everyone checks out code in whatever state it's in, applies their own system, then transforms it back, with no artifacts. That's hard.
- Ace17 8y agoSame here, with a twist: the test suite does: global reformat (uncrustify or astyle, depending on the team), build, run the actual tests. As people almost always run the test suite before checking code in, all the project stays properly formatted. My experience is: each time a team started doing this, all coding-style related discussions vanished, and it became a non-issue. It turns out it's a lot easier to accept a coding style you're not the one doing the actual formatting (this is why, BTW, I think stylechecking hooks alone are a bad idea).