Tabulation characters should not be used
Developers should not need to configure the tab width of their text editors in order to be able to read source code. So the use of tabulation character must be banned.
对于这一条大家怎么看?sonar把这条违例的债务定为2分钟。在oschina上可以自定义去掉这一条不?怎么弄?
Sonar
内部项目关系不大,设置好tab的width就可以了,因为通常团队内部都是用同一种编辑器的。
但是如果是开源项目,或者是跨平台(Solaris, Aix, Win等等)项目,最好还是用空格替换\t来保证可读性。
我不确定是否所有编辑器都有用空格替换\t的功能。但是对于vi来说,设置expandtab即可。
考虑跨平台可读性,还是空格的好,先用IDE设置tab默认替换空格就行了,对写代码没啥影响