# SPDX-FileCopyrightText: Catch2 Authors
# SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
# SPDX-License-Identifier: LGPL-3.0-or-later AND BSL-1.0

---
# Progmasoft Core C++ Coding Guidelines format profile, pinned to LLVM/Clang 23.1.0.
# Naming is intentionally outside clang-format and remains governed by the
# PascalCase/camelCase conventions of Progmasoft Core C++ Coding Guidelines.
Language: Cpp
BasedOnStyle: LLVM
Standard: c++17

UseTab: Never
IndentWidth: 4
ContinuationIndentWidth: 4
ConstructorInitializerIndentWidth: 4
AccessModifierOffset: -4
IndentAccessModifiers: false

# Keep formatted C++ source within the agreed 80-column width.
ColumnLimit: 80

BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel: true
  AfterClass: true
  AfterControlStatement: Always
  AfterEnum: true
  AfterExternBlock: true
  AfterFunction: true
  AfterNamespace: true
  AfterStruct: true
  AfterUnion: true
  BeforeCatch: true
  BeforeElse: true
  BeforeLambdaBody: false
  BeforeWhile: false
  IndentBraces: false
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false

AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
AllowShortNamespacesOnASingleLine: false
AllowShortRecordOnASingleLine: Never

# Function declarations and definitions keep the return type on its own line.
BreakAfterReturnType: All

PackArguments:
  BinPack: OnePerLine
PackParameters:
  BinPack: OnePerLine
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false

BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: true
AlignOperands: Align

BreakConstructorInitializers: BeforeComma
PackConstructorInitializers: Never
BreakInheritanceList: BeforeComma

PointerAlignment: Right
DerivePointerAlignment: false
QualifierAlignment: Leave

SpaceBeforeParens: ControlStatements
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeCpp11BracedList: false
SpacesInAngles: Never
SpacesInSquareBrackets: false
SpacesInParens: Never
SpaceInEmptyBraces: Never

Cpp11BracedListStyle: Block

SpaceAfterTemplateKeyword: false
BreakTemplateDeclarations: Yes

IndentCaseLabels: true
IndentCaseBlocks: false

NamespaceIndentation: All
FixNamespaceComments: true
ShortNamespaceLines: 0
CompactNamespaces: false

IndentPPDirectives: AfterHash
PPIndentWidth: 4

# System headers precede project headers, with alphabetical ordering per group.
IncludeBlocks: Regroup
SortIncludes: CaseSensitive
IncludeIsMainRegex: '$^'
IncludeCategories:
  - Regex: '^<.*>$'
    Priority: 1
    SortPriority: 1
  - Regex: '^".*"$'
    Priority: 2
    SortPriority: 2

MaxEmptyLinesToKeep: 1
KeepEmptyLines:
  AtStartOfBlock: false

ReflowComments: true
SortUsingDeclarations: Lexicographic

# Match the dominant line-ending convention of each input file.
LineEnding: DeriveLF
InsertNewlineAtEOF: true
...
