-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-format
79 lines (65 loc) · 2.35 KB
/
.clang-format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
# Basic style settings
BasedOnStyle: LLVM
IndentWidth: 4 # Set indentation width to 4 spaces
UseTab: Never # Use spaces instead of tabs
ColumnLimit: 120 # Limit line length to 120 characters
AllowShortIfStatementsOnASingleLine: false # Prevent short if statements on a single line
# Bracing styles
BreakBeforeBraces: Allman # Allman style for braces
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterStruct: true
BeforeCatch: true
BeforeElse: true
# Space management
SpaceBeforeParens: ControlStatements # Spaces before parentheses in control statements
SpaceAfterCStyleCast: true
SpaceInEmptyParentheses: false
# Pointer and reference alignment
PointerAlignment: Right # Align pointer to the right (int* ptr)
DerivePointerAlignment: false
# Indentation settings
IndentCaseLabels: true # Indent case labels in switch statements
IndentGotoLabels: true # Indent goto labels
IndentPPDirectives: None # Preprocessor directives are not indented
IndentWidth: 4 # Indentation width
TabWidth: 4 # Tab width
# Comment formatting
ReflowComments: true # Reflow long comments to fit within the column limit
# Include directives
IncludeBlocks: Preserve # Preserve include blocks
SortIncludes: true # Sort includes
# Function declaration and definition
AlignAfterOpenBracket: Align
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
# Align trailing comments
AlignTrailingComments: true
# Fix namespace indentation
FixNamespaceComments: true
NamespaceIndentation: All
# Align escapes in string literals
AlignEscapedNewlines: Left
# Allow short case labels on a single line
AllowShortCaseLabelsOnASingleLine: false
# Penalty settings to avoid breaking code lines too much
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
# Spaces around operators
SpaceBeforeRangeBasedForLoopColon: true
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
# Format macros
KeepEmptyLinesAtTheStartOfBlocks: false