Whitespace Wars: It’s over Tab has won

First I looked at dependency trees on Gentoo, Arch and Debian/Ubuntu and picked a common list of packages – to see what these mature core softwares do

Then I looked at a bunch of common editors to determine what their defaults are

And I finish by telling why I think the ‘Spacers’ are crazy, look at some of their popular arguments and then I’ll try to debunk them.

Collecting Popular Software

I built a few lists, looking at depencendy trees on various distributions. And I looked at what’s popular on Github, Ohloh, BitBucket, and Gitiourus.

for p in $(dpkg -l |awk ‘{ print $2 }’); do

apt-cache depends $p |awk ‘/Depends/ { print $2 }’

done

apt-cache show $p

On Gentoo: http://wiki.gentoo.org/wiki/Gentoolkit#Getting\_Dependency\_Graphs\_with\_depgraph_.28g.29

equery –no-color –quiet depgraph –depth=1 ‘*’ |awk ‘{ print $3 }’ |sort |uniq -c

Then, for each package I found it’s source code, then I used a code parsing tool (codoc.pl) to determine from the code the default choice and also searched for a documented project standard.

Project Depnedencis

Tested Packages:

Linux Kernel: – Tab

libc6

glibc

glib – 4s (in Python?) – https://sourceware.org/glibc/wiki/Style\_and\_Conventions

libssl / openssl / gnutls

libx11

libgcc1

gtk+

libstdc++

libselinux

libxml2

bash, dash, coreutils

gcc – 2 Spaces – https://gcc.gnu.org/wiki/CppConventions

autoconf

automake

make

cmake

sed

awk

git

subversion

perl – 4s – http://perldoc.perl.org/perlstyle.html

php – 4s – http://www.php-fig.org/psr/psr-2/ & http://pear.php.net/manual/en/standards.indenting.phphttp://framework.zend.com/manual/1.12/en/coding-standard.coding-style.html

python – 4s – https://www.python.org/dev/peps/pep-0008#indentation

ruby – 2s – https://github.com/styleguide/ruby

zip

ssh

atom

vim

emacs

jedit

apache

nginx – 4s – http://wiki.nginx.org/CodingStyle

freeswitch – Tab; 4c – https://wiki.freeswitch.org/wiki/Coding_Guidelines

postgresql – Tab; 4c – http://www.postgresql.org/docs/9.1/static/source-format.html

mysql – 2s – http://dev.mysql.com/doc/internals/en/indentation-spacing.html

mongodb – 4s – http://www.mongodb.org/about/contributors/reference/server-code-style/

gnome – Tabs or 2s – https://help.gnome.org/users/programming-guidelines/stable/c-coding-style.html.en

xfce – 4s – http://wiki.xfce.org/midori/contribute

kde

chromium – ?? – http://www.chromium.org/developers/coding-style – C follows Kernel; Python in 2s counter to PEP8; JavaScript 4s (http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml)

firefox – 2s – https://developer.mozilla.org/en-US/docs/Mozilla/Developer\_guide/Coding\_Style

webkit – 4s – https://www.webkit.org/coding/coding-style.html

qt

bitcoin

stellar

mediawiki – http://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP

Evaluating the Editors

It appears that the default across a super majority of these packages is to use a proper Tab.

Most have a configurable option to make them “soft” (spaces) and to adjust the display size to almost anything – including popular 2, 4 char visual width.

vim – Tab, 8c – auto, size, soft – http://tedlogan.com/techblog3.html

emacs – Tab, 8c – auto, size, soft –  http://www.emacswiki.org/emacs/IndentationBasics

nano – Tab, 8c – size, soft

pico – Tab, 8c – size, soft

edit (DOS) – Tab – no config

notepad – Tab, 8c – no config

wordpad – Tab, 8c – no config

jedit – Tab, ? – size, soft

eclipse – Tab – size, soft – http://eclipse.dzone.com/articles/spaces-vs-tabs-eclipse

sublime – Tab – size, soft – https://www.sublimetext.com/docs/2/indentation.html

Atom – Tab, 2c – size, soft – https://atom.io/docs/v0.59.0/customizing-atom

Notepad++

Kompozer

http://editorconfig.org/

A good read on the Space/Tab and reasons why it matteres – https://cwiki.apache.org/confluence/display/VCL/Perl+Code+Style+Guidelines

But Emacs thinks Tabs are Evil – http://www.emacswiki.org/emacs/TabsAreEvil

Google don’t like Tabs either: https://google-styleguide.googlecode.com/svn/trunk/google-c-style.el

https://code.google.com/p/google-styleguide/

http://codeguide.co/

http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/

http://www.ecyrd.com/JSPWiki/wiki/WhyTabsAreEvil