-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide on indentation in sharness and cleanup existing files #4002
Comments
Using tabs in go code is fine as that is the standard, but using tabs in shell files is a royal PITA for me (I use emacs). I would be much happier if we use 4 spaces. |
The standard for go is to use tab for indention and spaces for alignment. This makes a lot of sense. For example, it allows me to set the tab width to 4 without any ill effects. For go code, it also well supported in Emacs as it has a very good go mode and what ever it doesn't get right gofmt will fix for you. As far as I know this is not the case for shell files. By default emacs will indent using 4 spaces but then replace 8 spaces with a tab character. The replacing of 8 spaces with a tab character is all around bad so I (as I am sure lots of other people have) disabled this by setting I do not think it is possible to get emacs to use tabs just for indention for shell files. I can set Indenting within quotes for example:
Is even more of a pain as emacs does not see that as shell code but rather simply text within quotes. So to use tabs I have to use the Using 4 spaces (or maybe just 2) will make things easier for me as I am fighting emacs less. I am not totally against using tabs, it just that it is not well supported, at least for emacs, and for me. If people know of a better shell mode for emacs that addresses my concerns I will withdraw my objection to using tabs for indention. |
fwiw I also use emacs with |
I'm okay with spaces, PR uses tabs as it was easier to convert to, especially given that some files used 4 different indentation conventions. |
Someone has any objections against adding a header for vim to set indentation style correctly? For example of such header see cjdns: https://github.com/cjdelisle/cjdns/blob/master/client/Configurator.c Maybe something like that exists for emacs too? |
I'd rather not start adding headers to every file. Emacs allows per-directory variables (in a We could also use editorconfig.org but neither Vim nor Emacs have support out of the box. |
I'm fine with whatever as long as we have a script to enforce it |
So would everyone by happy with using 2 spaces? |
4 spaces is more standard and the default for Emacs, but I am okay with 2 also, it is easy enough to configure Emacs to use alternative setting for a directory. See, https://www.emacswiki.org/emacs/DirectoryVariables |
Yeah, but that's what Emacs users working on Git and Sharness (including me) do and it works quite well in practice. Also Sharness and Git will probably never change the way shell script are indented, so there will be a mismatch if it is changed for go-ipfs or even all the IPFS related projects. |
What caused me to create this issue was inconsistency. I am not for or against any style. I just want it to be consistent. |
I will repeat my objection to the use of tabs in text files unless it is done in the manner in go, that is tab for indention and spaces for alignment. It is unfortunate that this manor of indention is still widely used in practice. I still think 4 spaces is best. I am okay with 2 spaces. And if we decide to use tabs, I won't object again, but will often be mumbling to myself when ever I have to deal with it. :) I do agree that we should be consistent with all IPFS projects though. |
Indentation in sharness files is a mess. Most of the files are using tabs (3000 lines), we have about 500 lines of double space in the front and 500 of 4 spaces in the front, there are 7k lines total.
We should decide on indentation style, clean it up and set up tooling to control it.
The text was updated successfully, but these errors were encountered: