Whitespace

Put spaces around operators like =, ==, <, >, +, -, etc. Put space after comma. Do not put space before or after parenthesis in function calls or if/while/for statements.

Put whitespace around {}. Example:

// DON’T:
if (x+1==Foo(1,3) ){
SomeFunction ();
}
// DO:
if(x + 1 == Foo(1, 3)) {
SomeFunction();
}

Indent with spaces.

Rationale:

It makes output consistent in all tools, e.g. diff, git show, etc. It simplifies copy/paste from the terminal. Its WYSIWYG nature makes it harder to make mistakes. Use 4 spaces for indentation. Do not keep spaces at end of lines. Rationale: This can give false diffs. End text files with a single line break. Do not have blank lines at the end of the file.

Rationale: This avoids false diffs and avoids Git complaining about missing line break at end of file. Use Unix line endings (LF only), not Windows (CR+LF).

TODO: Figure out how to set this up in Git and Unity for Windows so it just works. Visual Studio is a problem here, as it has no easy way to work with Unix line endings.

Braces