-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.clang-format
More file actions
151 lines (112 loc) · 7.33 KB
/
.clang-format
File metadata and controls
151 lines (112 loc) · 7.33 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# -----------------------------------------------------------------------------
# mcpp-community C++ Style Configuration
#
# This configuration follows the style specification defined in:
# https://github.com/mcpp-community/mcpp-style-ref
#
# Maintained by: mcpp-community
# -----------------------------------------------------------------------------
Language: Cpp # Apply configuration to C++
# -----------------------------------------------------------------------------
# Language Standard
# -----------------------------------------------------------------------------
Standard: Latest # Always use the latest supported C++ standard
# -----------------------------------------------------------------------------
# Indentation
# -----------------------------------------------------------------------------
IndentWidth: 4 # Use 4 spaces for indentation
TabWidth: 4 # Visual width of tab
UseTab: Never # Never use tabs
# -----------------------------------------------------------------------------
# Line Width
# -----------------------------------------------------------------------------
ColumnLimit: 100 # Maximum line width
# -----------------------------------------------------------------------------
# Spaces
# -----------------------------------------------------------------------------
SpaceBeforeParens: ControlStatements # Space before parentheses for control statements (if/for/while); function calls remain tight
SpacesInContainerLiterals: true # Enforce spaces in container literals
SpaceBeforeAssignmentOperators: true # Add space before assignment operators
SpacesInParentheses: false # No extra spaces inside parentheses
PointerAlignment: Left # Pointer/reference attaches to type
QualifierAlignment: Left # Place qualifiers like const to the left
# -----------------------------------------------------------------------------
# Braces
# -----------------------------------------------------------------------------
BreakBeforeBraces: Attach # Opening brace stays on same line
AllowShortFunctionsOnASingleLine: Empty # Allow empty functions like `void f() {}`
AllowShortIfStatementsOnASingleLine: Never # Disallow single-line if statements
AllowShortBlocksOnASingleLine: Empty # Allow empty blocks on one line
AllowShortLoopsOnASingleLine: false # Disallow one-line loops
# -----------------------------------------------------------------------------
# Constructor Initializer List
# -----------------------------------------------------------------------------
BreakConstructorInitializers: BeforeColon # Keep initializer list compact when short
ConstructorInitializerAllOnOneLineOrOnePerLine: true # Allow compact initializer lists
BreakConstructorInitializersBeforeComma: false # Do not break before commas
# -----------------------------------------------------------------------------
# Access Modifiers
# -----------------------------------------------------------------------------
AccessModifierOffset: -4 # Align access modifiers with class indentation
EmptyLineBeforeAccessModifier: Never # Do not insert empty line before access specifiers
EmptyLineAfterAccessModifier: Never # Do not insert empty line after access specifiers
# -----------------------------------------------------------------------------
# Namespace Formatting
# -----------------------------------------------------------------------------
NamespaceIndentation: None # Do not indent contents inside namespace
FixNamespaceComments: true # Enforce closing namespace comments
CompactNamespaces: true # Prefer namespace a::b instead of nested namespaces
# -----------------------------------------------------------------------------
# Switch / Case Formatting
# -----------------------------------------------------------------------------
IndentCaseLabels: true # Indent case/default labels
IndentCaseBlocks: true # Indent statements inside case blocks
# -----------------------------------------------------------------------------
# Includes
# -----------------------------------------------------------------------------
SortIncludes: true # Automatically sort includes
IncludeBlocks: Regroup # Regroup include blocks
IncludeCategories:
- Regex: '^<.*>' # Standard / third-party headers
Priority: 1
- Regex: '^".*"' # Project headers
Priority: 2
# -----------------------------------------------------------------------------
# Comment Alignment
# -----------------------------------------------------------------------------
AlignTrailingComments: true # Align trailing comments
SpacesBeforeTrailingComments: 2 # Two spaces before trailing comments
# -----------------------------------------------------------------------------
# Parameter Formatting
# -----------------------------------------------------------------------------
BinPackParameters: true # Allow parameters on same line
BinPackArguments: true # Allow arguments on same line
# -----------------------------------------------------------------------------
# Template Formatting
# -----------------------------------------------------------------------------
AlwaysBreakTemplateDeclarations: Yes # Always place template declarations on their own line
# -----------------------------------------------------------------------------
# Operator Line Breaking
# -----------------------------------------------------------------------------
BreakBeforeBinaryOperators: None # Break after operators
# -----------------------------------------------------------------------------
# Method Chain Formatting
# -----------------------------------------------------------------------------
PenaltyBreakBeforeFirstCallParameter: 10000 # Avoid breaking chained calls unless necessary
# -----------------------------------------------------------------------------
# Lambda Formatting
# -----------------------------------------------------------------------------
AllowShortLambdasOnASingleLine: All # Allow short lambdas on one line
# -----------------------------------------------------------------------------
# Using Declarations
# -----------------------------------------------------------------------------
SortUsingDeclarations: true # Automatically sort using declarations
# -----------------------------------------------------------------------------
# Return Type Formatting
# -----------------------------------------------------------------------------
AlwaysBreakAfterReturnType: None # Break return type only when exceeding ColumnLimit
# -----------------------------------------------------------------------------
# Concepts / Requires
# -----------------------------------------------------------------------------
RequiresClausePosition: OwnLine # Force requires clause to a new line
IndentRequiresClause: false # Do not indent requires clause