20
skullyB
9y

I have a co-worker who negative-indents his function bodies. Minus four spaces. Every function. Not an IDE thing either, he does it intentionally.

I've never seen anything like it.

Comments
  • 0
    function something(){
    like this?
    }
  • 1
    @joaonunes missing the 4 spaces before the "function"
  • 1
    Sorry, 4 spaces back from where "function" is declared. So,

    function foo() {
    var stuff;
    }

    The weird thing is, when the function declaration is as far back as it can go, he indents normally.

    He claims his method makes it less ambiguous which blocks are invoked immediately and which blocks are declared but not invoked.
  • 0
    So no style guide then? 🤔
  • 0
    We actually do have coding standards that specify this very thing. He goes ahead and commits anyway.

    Also worth mentioning that we don't have a code review process, so... :/
  • 1
    @skullyB yeah that is what I was trying to type. Jesus Christ it looks ugly...
  • 3
    That's when I just select all and autoindent his whole commits. 😋 the key is never to say anything about it just keep doing it.
  • 0
    @Seethe Haha yep, I've definitely made a few commits along the lines of "Fixed some bad formatting, cough cough". But I hate when I'm about to commit something, then I realize that I have all these white space changes from auto-indent. I don't want to clutter my commits, so I have to pull my changes out, commit the format changes, then commit my stuff. Huge hassle when you're working with large files.
  • 1
    I'm so sorry. You should hack his stuff and make it auto format on save. And write a script that ensures that's the setting every time his ide starts.
Add Comment