# Stunts Engine — clang-format configuration
# Apply with:  clang-format -i src/*.c include/*.h
# Or use the CMake target:  cmake --build build --target format

Language: Cpp

# Start from a well-known base and override what differs.
BasedOnStyle: GNU

# --- Indentation ---
IndentWidth: 4
TabWidth: 4
UseTab: Never
ContinuationIndentWidth: 4
IndentCaseLabels: false
IndentPPDirectives: None
NamespaceIndentation: None

# --- Braces ---
BreakBeforeBraces: Custom
BraceWrapping:
  AfterFunction: false
  AfterControlStatement: Never
  AfterEnum: false
  AfterStruct: false
  AfterUnion: false
  AfterExternBlock: false
  BeforeElse: true
  BeforeWhile: false
  IndentBraces: false
  SplitEmptyFunction: false
  SplitEmptyRecord: false

# --- Line length ---
ColumnLimit: 100

# --- Spaces ---
SpaceBeforeParens: ControlStatements
SpaceAfterCStyleCast: false
SpacesInParentheses: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeRangeBasedForLoopColon: true

# --- Alignment ---
AlignConsecutiveMacros: Consecutive
AlignConsecutiveDeclarations: false
AlignConsecutiveAssignments: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true

# --- Pointer / reference alignment ---
PointerAlignment: Right
ReferenceAlignment: Right

# --- Includes ---
SortIncludes: Never

# --- Single-line blocks ---
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false

# --- Penalties ---
PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60

# --- Misc ---
AllowAllParametersOfDeclarationOnNextLine: true
BinPackArguments: true
BinPackParameters: true
BreakStringLiterals: false
IncludeBlocks: Preserve
MaxEmptyLinesToKeep: 2
ReflowComments: false
