-
Notifications
You must be signed in to change notification settings - Fork 86
/
.clang-format
195 lines (164 loc) · 3.39 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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
Language: Cpp
BasedOnStyle: Google
Standard: c++20
# Characters per line
ColumnLimit: 120
# Do not wrap comments according to ColumnLimit
ReflowComments: false
# Indentation
IndentWidth: 4
AccessModifierOffset: -4
UseTab: false
# Keep up to 2 empty lines
MaxEmptyLinesToKeep: 2
# sort and group includes: c++, system, project
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
# C++ Standard Library headers
- Regex: '<[[:alnum:]_-]+>'
Priority: 5
# system libraries
- Regex: '<.+>'
Priority: 4
# project includes - libdnf5 absolute paths
- Regex: '"libdnf5/.+"'
Priority: 3
# project includes - libdnf5-cli absolute paths
- Regex: '"libdnf5-cli/.+"'
Priority: 2
# project includes
- Regex: '".+"'
Priority: 1
# Always break after an open bracket, if the parameters don't fit on a single line, e.g.:
#
# someLongFunction(
# argument1, argument2);
#
AlignAfterOpenBracket: AlwaysBreak
# Forbid simple braced statements on a single line.
#
# Allowed:
# if (a) {
# return;
# }
#
# Forbidden:
# if (a) { return; }
#
AllowShortBlocksOnASingleLine: false
# Forbid short case labels on a single line.
#
# Allowed:
# switch (a) {
# case 1:
# x = 1;
# break;
# }
#
# Forbidden:
# switch (a) {
# case 1: x = 1; break;
# case 2: return;
# }
#
AllowShortCaseLabelsOnASingleLine: false
# Allow only single line methods defined inside a class.
#
# Allowed:
# class Foo {
# void f() { foo(); }
# };
# void f() {
# foo();
# }
#
# Forbidden:
# void f() { foo(); }
AllowShortFunctionsOnASingleLine: Inline
# Forbid if statements on a single line.
#
# Allowed:
# if (a)
# return ;
# else {
# return;
# }
#
# Forbidden:
# if (a) return;
# else
# return;
#
AllowShortIfStatementsOnASingleLine: Never
# Forbid loops on a single line.
#
# Allowed:
# while (i < 1) {
# i--;
# }
#
# Forbidden:
# while (i < 1) i--;
#
AllowShortLoopsOnASingleLine: false
# Force middle pointer alignment.
#
# Examples:
# char * str;
# const std::string & str;
#
DerivePointerAlignment: false
PointerAlignment: Middle
# Allow only one argument/parameter per line.
#
# Allowed:
# void f(int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
#
# Forbidden:
# void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
#
BinPackArguments: false
BinPackParameters: false
# If the function declaration doesn't fit on a line, put all parameters on the next line.
#
# Allowed:
# void myFunction(
# int a, int b, int c, int d, int e);
#
# Forbidden:
# void myFunction(int a,
# int b,
# int c,
# int d,
# int e);
#
AllowAllParametersOfDeclarationOnNextLine: true
# Allow only per line constructor intitializers.
#
# Allowed:
# MyClass::MyClass()
# : member0(0)
# , member1(2)
#
# Forbidden:
# MyClass::MyClass() :
# member0(0), member1(2)
#
AllowAllConstructorInitializersOnNextLine: false
BreakConstructorInitializers: BeforeColon
# Align consecutive C/C++ preprocessor macros.
#
# Example:
# #define SHORT_NAME 42
# #define LONGER_NAME 0x007f
# #define EVEN_LONGER_NAME (2)
# #define foo(x) (x * x)
# #define bar(y, z) (y + z)
#
AlignConsecutiveMacros: true
...