开发者

Dealing with whitespace in SVN?

开发者 https://www.devze.com 2022-12-31 22:36 出处:网络
All of the SVN shops I\'ve worked in have a strict rule - replace all tabs with spaces, to avoid whitespace conflicts and variations of tabs in different editors.

All of the SVN shops I've worked in have a strict rule - replace all tabs with spaces, to avoid whitespace conflicts and variations of tabs in different editors.

Is this a very common standard? Does it really make a huge difference, and is it worth the troubl开发者_运维百科e to push this standard to a group of developers new to SVN?


Unless you have a strict rule concerning spaces (and/or tabs), you should use tools that will ignore spaces when doing diff/compare/merge.


I'd say it's good to have some common indentation/whitespace standard, whether it's indentation by tabs, or by 4, 8 or whatever spaces. Linux kernel apparently uses tabs that should by 8 charactes wide, Python Style Guide prescribes 4 spaces per indentation level.

What coding style you choose matters on your taste. You might want to choose something similar to dominant style in environment you're using, but having it same across whole project makes easier for people to switch between various parts. (But it can make sense if you mix kernel-styled C and Python :-)


Tabs vs spaces is a hot debate, but ultimately you should standardize on one or the other (mixing tabs and spaces just leads to a mess). Whether you choose tabs or spaces, you should also standardize the width (e.g. 4 spaces, 8 spaces, etc).

Personally, I use tabs because I think they're easier to work with. And I make tabs equivalent to the width of 4 spaces in all editors.

0

精彩评论

暂无评论...
验证码 换一张
取 消