I'm currently part of the team implementing a new version control system (Subversion) within my organization. There's been a bit of a debate on how to handle code formatting and I'd like to get other peoples opinions and experiences on this topic.
We currently have ~10 developers each using different tools (due to licensing and preference). Some of these tools have automatic code formatters and others don't.
If we allow "blind" checkins the code will look drastically different each time someone does a check in. This will make things such as diffs and merges complicated.
I've talked to several people and they've mentioned the following solutions:
Regarding the 3rd point, the concept is to never auto-format the code and have some standards. Right now that seems to be what we're leaning towards. I'm a bit hesitant on that approach as it could lead to developers spending a lot of time manually formatting code.
If anyone can please provide some their thoughts and experience on this that would be great.
Thank you,
Martin
Don't let the tools/developers automatically/manually reformat the code just for aesthetic reasons. Diffing between revisions becomes a nightmare. Have a coding standard and try the toolsets to get new modules to conform as best as you can. People modifying an existing module should stick to the conventions used in that module whether they like it or not.
If #1 isn't a viable option, #3 is probably your best choice. #2 would make it rather difficult for individual developers to do diffs between a working copy and the existing file after they've checked it out and run their own formatter on it at least once.
Option #3 is mostly about getting people into habits - code formatting isn't really that troublesome if everyone can get into the same habit. The only code you have to format is that which you create/touch; the rest will be formatted from checkout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With