# clang-format configuration

UseTab: Never
ColumnLimit: 100

# Indent
IndentWidth: 4
BracedInitializerIndentWidth: 4
AccessModifierOffset: -4
IndentAccessModifiers: false
IndentCaseLabels: true
IndentExternBlock: Indent
IndentGotoLabels: true
IndentRequiresClause: true
IndentWrappedFunctionNames: true
NamespaceIndentation: None
LambdaBodyIndentation: Signature
BitFieldColonSpacing: Both

# Insert
InsertBraces: false
InsertNewlineAtEOF: true
KeepEmptyLinesAtEOF: true

# Align
AlignAfterOpenBracket: true
AlignTrailingComments:
  Kind: Always

AlignArrayOfStructures: Left
PointerAlignment: Left

BreakAfterAttributes: Leave
BreakAfterReturnType: Automatic
PenaltyReturnTypeOnItsOwnLine: 100
BreakBeforeConceptDeclarations: Always
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakAdjacentStringLiterals: false
BreakStringLiterals: false
CompactNamespaces: false
Cpp11BracedListStyle: true
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always

AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
RequiresClausePosition: OwnLine
BinPackArguments: false
BinPackParameters: OnePerLine

# Space
SeparateDefinitionBlocks: Always
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
  AfterControlStatements: false
  AfterForeachMacros: false
  AfterFunctionDeclarationName: false
  AfterFunctionDefinitionName: false
  AfterIfMacros: false
  AfterOverloadedOperator: false
  AfterRequiresInClause: true
  AfterRequiresInExpression: false
  BeforeNonEmptyParentheses: false

SpaceBeforeRangeBasedForLoopColon: false
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never

SpacesInParens: Custom
SpacesInParensOptions:
  InConditionalStatements: false
  InCStyleCasts: false
  InEmptyParentheses: false
  Other: false

SpacesInSquareBrackets: false

WrapNamespaceBodyWithEmptyLines: Always
# Order
QualifierAlignment: Custom
QualifierOrder: ["constexpr", "const", "inline", "static", "type"]
SortIncludes: true
SortUsingDeclarations: Never
IncludeBlocks: Regroup
IncludeCategories:
  - Regex: '^["<](spdlog|toml\+\+|coraing|cpptrace|flatbuffers|kota)/'
    Priority: 30
    SortPriority: 31

  - Regex: '^["<](llvm)/'
    Priority: 30
    SortPriority: 32

  - Regex: '^["<](clang)/'
    Priority: 30
    SortPriority: 33

  - Regex: '^["<](clang-tidy)/'
    Priority: 30
    SortPriority: 34

  - Regex: '^["<](Test)/'
    Priority: 20
    SortPriority: 22

  - Regex: "^<.*"
    Priority: 10
    SortPriority: 10

  - Regex: '^".*/.*"'
    Priority: 20
    SortPriority: 23

  - Regex: ".*"
    Priority: 20
    SortPriority: 21

ForEachMacros: ["REFLECTABLE_RECORD"]
NamespaceMacros: [TEST_SUITE]

KeepEmptyLines:
  AtEndOfFile: false
  AtStartOfBlock: false
  AtStartOfFile: false

StatementMacros:
  - DECO_CFG_START
  - DECO_CFG
  - DECO_CFG_END
  - DecoKV
  - DecoFlag
  - DecoComma
  - DecoInput
  - DecoPack
  - DecoKVStyled
  - DecoMulti
