TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Tabs or Spaces? The Top Starred Repositories in GitHub Analysed

63 pointsby fyskijover 9 years ago

16 comments

untogover 9 years ago
I don&#x27;t understand why this is still an issue in 2015. Why can&#x27;t our source control software take code indented any way, any how, and convert it to your personal preference when you pull the repo? It&#x27;s not like we enforce what color syntax highlighting you use or what font.<p>Honestly, the hours that have been wasted debating tedium like this in programming...
评论 #10795867 未加载
评论 #10795851 未加载
评论 #10795871 未加载
评论 #10795889 未加载
评论 #10795971 未加载
评论 #10796076 未加载
评论 #10796551 未加载
评论 #10795856 未加载
benatkinover 9 years ago
I wonder how many of those with tabs prefer their tab stops to be at something other than multiples of eight spaces. If it&#x27;s half of them that would be about a sixth of the repositories.<p>GitHub has addressed them by supporting .editorconfig. Setting a tab size in .editorconfig changes the tab size for viewing files but not diffs (last I checked, a couple of months ago). If any GitHubber is reading, it would be great for that preference to be used for diffs as well!<p><a href="http:&#x2F;&#x2F;editorconfig.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;editorconfig.org&#x2F;</a>
评论 #10795891 未加载
SwellJoeover 9 years ago
Anyone know why Ruby is 100% for 2 spaces? That seems impossible. Even Go isn&#x27;t <i>that</i> consistent and it has gofmt which seemingly everyone uses.
评论 #10795936 未加载
评论 #10795924 未加载
pmiller2over 9 years ago
I find it interesting that certain languages (F#, Ruby, Scala) are so polarized against tabs. Some make sense, like Haskell, Go, or Python (and, to an extent, CSS), but the rest kind of baffle me.
评论 #10796135 未加载
评论 #10795974 未加载
nikolayover 9 years ago
I prefer leading tabs and spaces for everything else. The fight over tab size is irrelevant in the case where you align with spaces outside of indenting with tabs.
forgotmypasswover 9 years ago
Personally I prefer tabs for indentation and spaces for alignment. Also what&#x27;s wrong with these charts? They keep shrinking and expanding you can&#x27;t tell what&#x27;s going on.
santaclausover 9 years ago
Three spaces fares horribly in this analysis. I wonder why the aversion for three? Are odd numbers inherently less appealing?
评论 #10796066 未加载
评论 #10797098 未加载
stordoffover 9 years ago
Looking at this just made me realise that IDLE (Python IDE) inserts four spaces instead of tab when you indent using the tab key. I&#x27;ve always used tabs (1 tab = 1 level of indentation) for my personal projects, and only just realised why IDLE&#x27;s &quot;tabs&quot; seem short by default.
评论 #10795951 未加载
markbnjover 9 years ago
Interesting! I assume tabs being so common in C projects has to do with their use in makefiles. But what is up with Go? Why are tabs used exclusively there? Not a Go programmer so I assume that must reflect something in the language or typical tool chain.
评论 #10797089 未加载
评论 #10795844 未加载
评论 #10795843 未加载
评论 #10795837 未加载
ChuckMcMover 9 years ago
That is a fun analysis, I use 4 space tabs (where hard tabs are in the code, and ts=4 in .vimrc). Hard tabs are essential on proportional font editing systems, otherwise your code goes all over the screen!
smilekzsover 9 years ago
The pie chart would be more readable if the &quot;space count&quot; is directly on the pie slice (instead of tooltip&#x2F;legend)
awqrreover 9 years ago
Why use such a small selection of repositories? and why does Go seem to use all tabs?
Gedrovitsover 9 years ago
I like the Ruby, it really have example &quot;standard&quot;.
jehna1over 9 years ago
Just a side note: why does a website still need to alter my browser&#x27;s scroll in 2015?
评论 #10795947 未加载
dendoryover 9 years ago
I really cringe when dealing with spaces, which is a real problem since I code in Python a lot, which cannot deal with a mix of both. I don&#x27;t understand people using 2 or 4 spaces at every line, it&#x27;s so much slower. Sure the first time they probably use a tab and their editor is setup to replace with spaces, but as soon as you go back to edit you need to deal with the multiple spaces.<p>I say tabs for all!
Jemaclusover 9 years ago
Tabs for indentation, hands down. Every editor out there worth its salt can adjust the tab size the way you want. If you want 1 tab = 2 spaces, you can do that. If I want 1 tab = 4 spaces, I can do that. Either way, it&#x27;s one tab, and we&#x27;re all happy. It&#x27;s literally a win&#x2F;win scenario. I have never understood the argument for spaces for indentation, not when tabs are at our disposal.
评论 #10795986 未加载
评论 #10795977 未加载
评论 #10796032 未加载
评论 #10795982 未加载