
400k GitHub Repositories: Spaces or Tabs? - ironchief
https://medium.com/@hoffa/400-000-github-repositories-1-billion-files-14-terabytes-of-code-spaces-or-tabs-7cfe0b5dd7fd#.o1d3cmm5r
======
greenyoda
Previous discussion:
[https://news.ycombinator.com/item?id=12397246](https://news.ycombinator.com/item?id=12397246)

------
gramakri
Would be interesting to see a statistic on 2 spaces vs 4 spaces as well.
Somehow, I can never get used to 2 spaces, the code feels too cluttered. This
applies to json/html/xml as well.

------
teacurran
I imagine a lot of the stats are based on tooling defaults. For Java we have a
corporate standard to use tabs but most developers aren't even aware of their
indents. Eclipse defaults to spaces so thats what ends up in a lot of code.

------
catskul2
I've found that a lot of developers I talk to prefer tabs (for indenting only)
but go with spaces when they start a new project because they feel like it's
less contentious for some reason.

------
phantom_oracle
Am I seeing something totally incorrect?

It says:

py | files/tabs = 27,525 | files/spaces = 589,917

How is this possible?

~~~
LoneWolf
I fail to see what is the problem, care to elaborate?

~~~
perrygeo
Spaces are strongly preferred in the official style guide:
[https://www.python.org/dev/peps/pep-0008/#tabs-or-
spaces](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces). I've been
programming Python for 11 years now and have never seen a file with tab
indentation.

~~~
DougN7
But tabs let everyone see it how they want to. I've never understood the draw
for spaces...

------
dashoffset
Interesting how Ruby has almost no code indented with tabs, while Go has
almost no code indented with spaces (I believe this is due to gofmt, but I
might be wrong).

~~~
phasmantistes
Yep, it's due to gofmt, which enforces tabs for all semantic indentation and
spaces for all alignment indentation (which means lines never _start_ with a
space).

~~~
Chaoshade
"Hey guys, how can we make the whole tabs vs. spaces thing even worse?

"How about we promote mixing the two?"

~~~
cyphar
Actually, I think that mixing the two (alignment is for spaces, indentation is
for tabs) fixes all of the problems faced by both camps. It makes the tab
width configurable, without ruining any visual alignment you've done.

~~~
delcaran
That is what I use, tab for indentation (left-most chars of the line), space
for alignment.

This what, regardless the editor, the indentation is always correct and the
alignment all the same, the code simply slides left or right depending on the
tab-size of the editor.

------
Daviey
Repost
[https://news.ycombinator.com/item?id=12397246](https://news.ycombinator.com/item?id=12397246)

------
gkanapathy
Hmm, but how many .vimrcs have

set shiftwidth=4 softtabstop=4 expandtab

~~~
AjithAntony
well, yes, of course all the space users are using the <tab> key.

