Table of Contents

Formatting & Braces

Quick-glance reference. See EditorConfig docs for tooling setup.

General Formatting

Setting Value
Charset UTF-8
Line endings CRLF
Indent style Spaces
Indent size 4
Trailing whitespace Trimmed
Final newline Required
Max consecutive blank lines 1

Brace Placement — Allman Style

Opening brace on a new line for everything.

namespace PixelEngine.Core
{
    public class GameManager
    {
        public void Initialize()
        {
            if (isReady)
            {
                Start();
            }
            else
            {
                Prepare();
            }
        }
    }
}

Single-Line Blocks

// OK — truly single line
if (isReady) Start();

// PREFERRED — always use braces
if (isReady)
{
    Start();
}

// NEVER — multiline without braces
if (isReady)
    Start();  // BAD

Indentation Rules

Context Indented?
Block contents Yes
Braces themselves No
case contents Yes
switch labels Yes
Labels (goto targets) Flush left

Spacing Rules

Context Space?
After cast (int)x No
After comma a, b, c Yes
After dot obj.Method No
After keywords if (, for ( Yes
After semicolons in for Yes
Around binary operators a + b Yes
Around colon in inheritance : Base Yes
Before comma No
Between method name and ( No
Inside parens ( x ) No
Inside brackets [ i ] No
Empty param list () No