# Clang-Format Configuration for wayland-bongocat
# Best practices for C23-compatible code
---
# Base style
BasedOnStyle: LLVM
IndentWidth: 2
---
# Language
Language: Cpp
Standard: Latest

# Indentation
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentExternBlock: NoIndent

# Column limit
ColumnLimit: 120

# Alignment
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true

# Pointer and reference alignment
PointerAlignment: Right
ReferenceAlignment: Left
DerivePointerAlignment: false

# Braces
BreakBeforeBraces: Attach
BraceWrapping:
  AfterCaseLabel: false
  AfterControlStatement: Never
  AfterEnum: false
  AfterFunction: false
  AfterStruct: false
  AfterUnion: false
  AfterExternBlock: false
  BeforeElse: false
  BeforeWhile: false
  IndentBraces: false

# Line breaks
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
NamespaceIndentation: Inner
FixNamespaceComments: true
BreakConstructorInitializers: BeforeComma
ConstructorInitializerAllOnOneLineOrOnePerLine: true
AllowAllConstructorInitializersOnNextLine: false
IndentWrappedFunctionNames: false
AlwaysBreakTemplateDeclarations: Yes

# Spaces
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

# Includes
SortIncludes: CaseSensitive
IncludeBlocks: Regroup
IncludeCategories:
  # Project headers first (quoted includes)
  - Regex: '^"'
    Priority: 1
  # System headers
  - Regex: "^<"
    Priority: 2

# Penalties (to control line breaking decisions)
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60

# Miscellaneous
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
ReflowComments: true
SeparateDefinitionBlocks: Leave
InsertBraces: false
RemoveBracesLLVM: false
---
Language: JavaScript
IndentWidth: 2
ColumnLimit: 120