94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
# .clang-format
|
|
---
|
|
# Base style to inherit from (llvm, google, chromium, microsoft, mozilla, webkit)
|
|
BasedOnStyle: microsoft
|
|
|
|
# Indentation
|
|
IndentWidth: 4 # Number of spaces per indent level
|
|
TabWidth: 4 # Number of spaces per tab
|
|
UseTab: Never # Options: Never, ForIndentation, Always
|
|
|
|
# Braces
|
|
BreakBeforeBraces: Allman # Options: Attach, Linux, Stroustrup, Allman, GNU, WebKit, Custom
|
|
BraceWrapping:
|
|
AfterClass: true # Put brace on new line after class
|
|
AfterControlStatement: true
|
|
AfterEnum: true
|
|
AfterFunction: true
|
|
AfterNamespace: true
|
|
AfterStruct: true
|
|
AfterUnion: true
|
|
BeforeCatch: true
|
|
BeforeElse: true
|
|
IndentBraces: false
|
|
|
|
# Spaces
|
|
SpaceBeforeParens: ControlStatements # Options: Never, ControlStatements, Always
|
|
SpaceInEmptyParentheses: false
|
|
SpacesInParentheses: false
|
|
SpacesInSquareBrackets: false
|
|
SpacesInAngles: false
|
|
SpaceAfterCStyleCast: false
|
|
SpaceAfterTemplateKeyword: true
|
|
|
|
# Alignment
|
|
AlignConsecutiveAssignments: true
|
|
AlignConsecutiveDeclarations: true
|
|
AlignEscapedNewlines: Right
|
|
AlignOperands: true
|
|
AlignTrailingComments: true
|
|
|
|
# Column limit
|
|
ColumnLimit: 80 # Max line length before wrapping
|
|
|
|
# Pointer/reference alignment
|
|
PointerAlignment: Right # Options: Left, Right, Middle
|
|
|
|
# Includes
|
|
IncludeBlocks: Regroup # Options: Preserve, Merge, Regroup
|
|
IncludeCategories:
|
|
- Regex: '^<.*\.h>'
|
|
Priority: 2
|
|
SortPriority: 0
|
|
CaseSensitive: false
|
|
- Regex: '^<.*>'
|
|
Priority: 1
|
|
SortPriority: 0
|
|
CaseSensitive: false
|
|
- Regex: '^".*\.hpp"'
|
|
Priority: 3
|
|
SortPriority: 0
|
|
CaseSensitive: false
|
|
- Regex: '^".*\.h"'
|
|
Priority: 4
|
|
SortPriority: 0
|
|
CaseSensitive: false
|
|
SortIncludes: true
|
|
|
|
# Function declaration/definition formatting
|
|
AllowAllParametersOfDeclarationOnNextLine: true
|
|
BinPackParameters: true
|
|
BinPackArguments: true
|
|
|
|
# Namespace indentation
|
|
NamespaceIndentation: None # Options: None, Inner, All
|
|
|
|
# Constructor initializer formatting
|
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
|
ConstructorInitializerIndentWidth: 4
|
|
|
|
# Access modifier indentation
|
|
AccessModifierOffset: -2
|
|
|
|
# Trailing commas
|
|
Cpp11BracedListStyle: true
|
|
|
|
# Comment formatting
|
|
ReflowComments: true
|
|
SpacesBeforeTrailingComments: 1
|
|
|
|
# Misc
|
|
IndentCaseLabels: true
|
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
|
MaxEmptyLinesToKeep: 1
|