Hacker News new | ask | show | jobs
by shaftway 2286 days ago
Every team I've been on at Google has presubmits that enforce this, along with command line tools to "fix" it. There's no arguments about spacing. Nobody really cares about extra lines, but if you use tabs instead of spaces you're just wrong and your CL can't be submitted.

It's actually nice. I disagree with some of the rules and would like them to change. I think that if your if-block has a single statement and there's no else, and it all fits in a line then it's fine to inline it.

    if (theAnswerIsKnown) return theAnswer;
But I'm wrong. Because the linter doesn't allow it. So I moved on and I don't bother fighting that fight.

Edit: To be clear, I might be right, and this might be better, but I'm "wrong" in the sense that it's not linter compliant.

1 comments

w.r.t "if you use tabs instead of spaces you're just wrong", can you expand on that?

Do you mean 'wrong' in the sense of 'wrong according to the rules enforced by the linter' or 'wrong philosophically' ? If it's the latter, how is that wrong and is not even a subject for debate?

This is an honest question, I guess I just don't see how something like this can "just" be wrong (to me it's irrelevant and not worth the ink used to write such statements in code reviews... though I'm playing devil's advocate here obviously :-) ).

PS: of course if pre-submit checks enforce the rules, then as you said it becomes a non-issue. I have been in environments where there are no such tool-enforced checks, yet people comment on it endlessly, routinely blocking code reviews for whitespace issues...