Closed dreamfall closed 12 years ago
Is this a major issue?
Yeah, it is. A lot of ruby developers setup their editors to replace tabs with 2 whitespaces. So every time someone edit file he'll have a bunch of changes. So I suppose it should be fixed, the sooner the better :+1:
@dreamfall git can handle this automatically, would that be a solution, if I added the appropriate configuration so that on pull, tabs -> your preferred indentation and on commit -> tabs again?
@dreamfall @lest B.T.W. thanks for taking the time to review my project and submit a patch.
I don't think it will be a good solution. There is a ruby style guide telling to use two spaces instead of tabs.
And github also have troubles with displaying files with tabs
@dreamfall are you planning to commit something more substantial to this project?
@ioquatix we just decided to try your gem in our project.
@dreamfall I'm not sure I'm seeing any issues with the above screenshot?
I'm using tabs for indentation across about 60 projects, with about 10-15 of those being Ruby gems. My main concern is (a) that on my end I have all my editors set up to use tabs (b) I prefer tab indentation since I find it easier to edit the text with less keystrokes and better alignment and (c) breaking consistency with all my other projects.
If you are just using the gem, how is the whitespace of the source code important?
It's easy to setup your editor to place two spaces when you press tab button. So there won't be any additional keystrokes.
I'm just trying to make your gem better and easier to contribute.
@dreamfall Yes I know and I do appreciate that.
@ioquatix I personally prefer using spaces (not only in Ruby) and you like using tabs. As you've noticed, everything is fine as long as we don't mix them. But that's exactly what will happen as soon as you receive first meaningful pull request to one of your Ruby projects. The reason is that most of the Ruby programmers use 2 spaces for indentation and this fact is also mentioned in the community-driven style guide.
Maybe it's not critical right now for this particular project, but if you want people to contribute to your Ruby projects, you better accept community's guidelines rather than fight against them. It's much easier than reformatting the code after every pull request with 2-spaces indentation or ask people to send pull requests only with tabs indentation.
I'm pretty sure you can easily setup your editors to use 2-spaces indentation for Ruby and tabs for other languages. Besides, most of the editors are capable of indenting with 2 spaces when you press Tab key and un-indenting 2 spaces automatically, e.g., when you press Shift+Tab, so you'll never need to type or remove these 2 spaces manually.
@KL-7 Yes, I agree with the social argument that spaces seems to be a useful convention, out of everything discussed so far its the only real reason why I'd consider accepting this patch.
However that being said, the most respectful way to contribute to someone else's project is to try to follow their coding style. Personally, when I contribute to other people's projects I usually try to follow their indentation and style.
@ioquatix you're basically telling contributors to ignore common guidelines and follow your own Ruby style. I don't think that's how open-source projects should be maintained, because if maintainer is interested in contributions from other people (I'm not sure whether you are) it's his job to make contribution as easy as possible.
Anyway, your project – your rules. Good luck with that. I hope people will find your gem useful regardless of the indentation style you're using and you'll have lots of patient contributors that will indent code with tabs in their pull requests for you.
I think it makes sense to optimise for the more common situation, which is presumably the primary developer. I'm sure everyone wanting to submit patches is capable of figuring out indentation.
As an aside, I also prefer tabs in files, because you can easily configure your editor to display them as whatever width you prefer. Personally I prefer width 2, but a lot of my co-workers use 4. If we serialise as tabs, everyone's happy.
There is a convention to use two spaces instead of tabs :scissors: