HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Beware the 4-spacening this week (25 May)

LincLinc Admin

This week we will be converting Vanilla to a 4-space indent system from our current 3-space indent system per the coding standard we adopted last year. This is for our pull request authors - if you're in the middle of something, this change will undoubtedly cause a merge conflict. A diff program like Kaleidoscope should help you easily resolve it, but it will be a little extra work.

«13

Comments

  • x00x00 MVP
    edited May 2015

    If people like to develop in a different standard, you can set up in/out filters

    This is not the exact example but the some of the to things you can do:

    http://alexzaytsev.me/2014/10/19/git-filter-to-convert-spaces-to-tabs-and-vice-versa/

    When I develop on a project that uses tabs I use filters so I can use spaces, and it converts to tabs when I push, and back to spaces when pulling.

    I also use other filters such trimming whitespace off end of lines and empty lines.

    grep is your friend.

  • @x00 That's a good idea. I use tabs all the time, I don't like "hard" spaces. A filter to go from one to the other will definitely be useful.

  • x00x00 MVP
    edited May 2015

    @businessdad follow the example

    ~/.gitconfig

    [filter "tabs2spaces"]
        clean = expand --tabs=4 --initial
        smudge = unexpand --tabs=4 --first-only
    [filter "trimWhitespace"]
        clean = git-stripspace
    

    and .git/info/attributes

    *.php filter=trimWhitespace
    *.php filter=tabs2spaces
    *.html filter=trimWhitespace
    *.html filter=tabs2spaces
    *.css filter=trimWhitespace
    *.css filter=tabs2spaces
    *.js filter=trimWhitespace
    *.js filter=tabs2spaces
    *.yml fliter=trimWhitespace
    *.json fliter=trimWhitespace
    *.txt fliter=trimWhitespace
    *.md fliter=trimWhitespace
    

    grep is your friend.

  • Thanks @x00. In my case, I will try to transform spaces to tabs locally, and tabs to spaces on commit. :)

  • That is basically what clean and smudge does.

    I would covert your files to tabs anyway, becuase when they covert it to four spaces, you tabs will covert to the correct spaces. Which is a bit more complicated with mixed scenario.

    grep is your friend.

  • I use spaces2tabs on tab projects, becuase I'm a spaces guy.

    I'm a spaces guy becuase I have an aversion to arrows, and like little grey dots. ;)

    grep is your friend.

  • @x00 said:
    I use spaces2tabs on tab projects, becuase I'm a spaces guy.

    I'm a spaces guy becuase I have an aversion to arrows, and like little grey dots. ;)

    I hide those characters, so it doesn't make a difference to me, from that perspective. :)

  • x00x00 MVP
    edited May 2015

    It is not right to hide those characters. what is wrong with you business dad? :shivers:

    grep is your friend.

  • @x00 said:
    It is not right to hide those characters. what is wrong with you business dad? :shivers:

    He likes his world full of wonder and mistery. Is it a space? A tab? Who knows? (doing jazz hands) Mistery...

  • chanhchanh ✭✭

    It seems most if not all coding standard all spaces now a day. Some 2x, some 4x but I can understand the use of space is more universality across platform and IDE. I use various editor for the task and by using spaces it would be more consistent in any IDE.

  • LincLinc Admin

    We're probably going to wait until Monday or Tuesday to do this because we currently have a runaway pull request that needs to get merged first. :)

  • @x00 said:
    It is not right to hide those characters. what is wrong with you business dad? :shivers:

    It's perfectly right, they are just noise anyway. They are called "invisible characters" for a reason. :)

  • @chanh said:
    It seems most if not all coding standard all spaces now a day. Some 2x, some 4x but I can understand the use of space is more universality across platform and IDE. I use various editor for the task and by using spaces it would be more consistent in any IDE.

    Except that with tabs you can make them look as you like. For example, I don't like four spaces, too "wide". With hard spaces, there's nothing to do, apart from the usual search and replace. With tabs, you can tell the editor to show one tab as two spaces, and you're ready to go. If you like four spaces, you can still set the editor accordingly.

  • @businessdad said:
    Except that with tabs you can make them look as you like. For example, I don't like four spaces, too "wide". With hard spaces, there's nothing to do, apart from the usual search and replace. With tabs, you can tell the editor to show one tab as two spaces, and you're ready to go. If you like four spaces, you can still set the editor accordingly.

    This works perfectly fine for indentation purposes. If you are trying to make your code look pretty and use tabs, bad things can happen if the tab is narrower than expected. At this point it is really splitting hairs.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @xDaizu said:
    He likes his world full of wonder and mistery. Is it a space? A tab? Who knows? (doing jazz hands) Mistery...

    Not a mistery, in fact I replace all the leading spaces with tabs before I start on some "foreign" code. So the indentation is always a tab, no mystery. :pleased:

    This discussion is becoming philosophical...

  • chanhchanh ✭✭

    tabs are nice only if you is the only person work on your code and you only use one editor but if there are lot of people working the code and use various editor, tabs can create headache and look ugly too!

  • LincLinc Admin

  • LincLinc Admin

    We played O Fortuna in the office as it began, then 2001 Space Odyssey. Then we ran out of epic songs and the non-devs started to give us the stink eye. :chuffed:

  • Are you using an IDE code formatting function to update the files?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.