# .clang-format for PEP 7 (Python C Style Guide)
# See: https://peps.python.org/pep-0007/
---
BasedOnStyle: Google
Language: C

# Indentation and whitespace
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 79
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: BeforeHash

# Braces and blocks
BreakBeforeBraces: Stroustrup
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortBlocksOnASingleLine: Never
AllowShortBracesOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortRecordsOnASingleLine: false
AlwaysBreakAfterReturnType: All

# Spaces
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeParensOptions:
  AfterControlStatements: true
  AfterForeachMacros: true
  AfterFunctionDeclarationName: false
  AfterFunctionDefinitionName: false
  AfterIfMacros: true
  AfterOverloadedOperator: false
  AfterRequiresInClause: true
  AfterRequiresInExpression: true

# Pointer and reference alignment
PointerAlignment: Right
DerivePointerAlignment: false

# Includes
SortIncludes: false

# Comments
ReflowComments: true

# Misc
InsertTrailingCommas: None
InsertBraces: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1

# Function declaration/definition
AlwaysBreakAfterDefinitionReturnType: None
BreakAfterAttributes: Leave

# Macro formatting (cannot enforce PEP 7's macro idioms, but keep formatting clean)
AllowShortCaseLabelsOnASingleLine: false
...

---
BasedOnStyle: Google
Language: Cpp

# Indentation and whitespace
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 79
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: BeforeHash

# Braces and blocks
BreakBeforeBraces: Stroustrup
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortBlocksOnASingleLine: Never
AllowShortBracesOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortRecordsOnASingleLine: false
AlwaysBreakAfterReturnType: All

# Spaces
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeParensOptions:
  AfterControlStatements: true
  AfterForeachMacros: true
  AfterFunctionDeclarationName: false
  AfterFunctionDefinitionName: false
  AfterIfMacros: true
  AfterOverloadedOperator: false
  AfterRequiresInClause: true
  AfterRequiresInExpression: true

# Pointer and reference alignment
PointerAlignment: Right
DerivePointerAlignment: false

# Includes
SortIncludes: false

# Comments
ReflowComments: true

# Misc
InsertTrailingCommas: None
InsertBraces: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1

# Function declaration/definition
AlwaysBreakAfterDefinitionReturnType: None
BreakAfterAttributes: Leave

# Macro formatting (cannot enforce PEP 7's macro idioms, but keep formatting clean)
AllowShortCaseLabelsOnASingleLine: false
...