git

Форк
0
/
.clang-format 
221 строка · 5.9 Кб
1
# This file is an example configuration for clang-format 5.0.
2
#
3
# Note that this style definition should only be understood as a hint
4
# for writing new code. The rules are still work-in-progress and does
5
# not yet exactly match the style we have in the existing code.
6

7
# Use tabs whenever we need to fill whitespace that spans at least from one tab
8
# stop to the next one.
9
#
10
# These settings are mirrored in .editorconfig.  Keep them in sync.
11
UseTab: Always
12
TabWidth: 8
13
IndentWidth: 8
14
ContinuationIndentWidth: 8
15
ColumnLimit: 80
16

17
# C Language specifics
18
Language: Cpp
19

20
# Align parameters on the open bracket
21
# someLongFunction(argument1,
22
#                  argument2);
23
AlignAfterOpenBracket: Align
24

25
# Don't align consecutive assignments
26
# int aaaa = 12;
27
# int b = 14;
28
AlignConsecutiveAssignments: false
29

30
# Don't align consecutive declarations
31
# int aaaa = 12;
32
# double b = 3.14;
33
AlignConsecutiveDeclarations: false
34

35
# Align escaped newlines as far left as possible
36
# #define A   \
37
#   int aaaa; \
38
#   int b;    \
39
#   int cccccccc;
40
AlignEscapedNewlines: Left
41

42
# Align operands of binary and ternary expressions
43
# int aaa = bbbbbbbbbbb +
44
#           cccccc;
45
AlignOperands: true
46

47
# Don't align trailing comments
48
# int a; // Comment a
49
# int b = 2; // Comment b
50
AlignTrailingComments: false
51

52
# By default don't allow putting parameters onto the next line
53
# myFunction(foo, bar, baz);
54
AllowAllParametersOfDeclarationOnNextLine: false
55

56
# Don't allow short braced statements to be on a single line
57
# if (a)           not       if (a) return;
58
#   return;
59
AllowShortBlocksOnASingleLine: false
60
AllowShortCaseLabelsOnASingleLine: false
61
AllowShortFunctionsOnASingleLine: false
62
AllowShortIfStatementsOnASingleLine: false
63
AllowShortLoopsOnASingleLine: false
64

65
# By default don't add a line break after the return type of top-level functions
66
# int foo();
67
AlwaysBreakAfterReturnType: None
68

69
# Pack as many parameters or arguments onto the same line as possible
70
# int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
71
#                int cccc);
72
BinPackArguments: true
73
BinPackParameters: true
74

75
# Add no space around the bit field
76
# unsigned bf:2;
77
BitFieldColonSpacing: None
78

79
# Attach braces to surrounding context except break before braces on function
80
# definitions.
81
# void foo()
82
# {
83
#    if (true) {
84
#    } else {
85
#    }
86
# };
87
BreakBeforeBraces: Linux
88

89
# Break after operators
90
# int value = aaaaaaaaaaaaa +
91
#             bbbbbb -
92
#             ccccccccccc;
93
BreakBeforeBinaryOperators: None
94
BreakBeforeTernaryOperators: false
95

96
# Don't break string literals
97
BreakStringLiterals: false
98

99
# Use the same indentation level as for the switch statement.
100
# Switch statement body is always indented one level more than case labels.
101
IndentCaseLabels: false
102

103
# Indents directives before the hash. Each level uses a single space for
104
# indentation.
105
# #if FOO
106
# # include <foo>
107
# #endif
108
IndentPPDirectives: AfterHash
109
PPIndentWidth: 1
110

111
# Don't indent a function definition or declaration if it is wrapped after the
112
# type
113
IndentWrappedFunctionNames: false
114

115
# Align pointer to the right
116
# int *a;
117
PointerAlignment: Right
118

119
# Don't insert a space after a cast
120
# x = (int32)y;    not    x = (int32) y;
121
SpaceAfterCStyleCast: false
122

123
# No space is inserted after the logical not operator
124
SpaceAfterLogicalNot: false
125

126
# Insert spaces before and after assignment operators
127
# int a = 5;    not    int a=5;
128
# a += 42;             a+=42;
129
SpaceBeforeAssignmentOperators: true
130

131
# Spaces will be removed before case colon.
132
# case 1: break;    not     case 1 : break;
133
SpaceBeforeCaseColon: false
134

135
# Put a space before opening parentheses only after control statement keywords.
136
# void f() {
137
#   if (true) {
138
#     f();
139
#   }
140
# }
141
SpaceBeforeParens: ControlStatements
142

143
# Don't insert spaces inside empty '()'
144
SpaceInEmptyParentheses: false
145

146
# No space before first '[' in arrays
147
# int a[5][5];     not      int a [5][5];
148
SpaceBeforeSquareBrackets: false
149

150
# No space will be inserted into {}
151
# while (true) {}    not    while (true) { }
152
SpaceInEmptyBlock: false
153

154
# The number of spaces before trailing line comments (// - comments).
155
# This does not affect trailing block comments (/* - comments).
156
SpacesBeforeTrailingComments: 1
157

158
# Don't insert spaces in casts
159
# x = (int32) y;    not    x = ( int32 ) y;
160
SpacesInCStyleCastParentheses: false
161

162
# Don't insert spaces inside container literals
163
# var arr = [1, 2, 3];    not    var arr = [ 1, 2, 3 ];
164
SpacesInContainerLiterals: false
165

166
# Don't insert spaces after '(' or before ')'
167
# f(arg);    not    f( arg );
168
SpacesInParentheses: false
169

170
# Don't insert spaces after '[' or before ']'
171
# int a[5];    not    int a[ 5 ];
172
SpacesInSquareBrackets: false
173

174
# Insert a space after '{' and before '}' in struct initializers
175
Cpp11BracedListStyle: false
176

177
# A list of macros that should be interpreted as foreach loops instead of as
178
# function calls. Taken from:
179
#   git grep -h '^#define [^[:space:]]*for_\?each[^[:space:]]*(' |
180
#   sed "s/^#define /  - '/; s/(.*$/'/" | sort | uniq
181
ForEachMacros:
182
  - 'for_each_builtin'
183
  - 'for_each_string_list_item'
184
  - 'for_each_ut'
185
  - 'for_each_wanted_builtin'
186
  - 'hashmap_for_each_entry'
187
  - 'hashmap_for_each_entry_from'
188
  - 'kh_foreach'
189
  - 'kh_foreach_value'
190
  - 'list_for_each'
191
  - 'list_for_each_dir'
192
  - 'list_for_each_prev'
193
  - 'list_for_each_prev_safe'
194
  - 'list_for_each_safe'
195
  - 'strintmap_for_each_entry'
196
  - 'strmap_for_each_entry'
197
  - 'strset_for_each_entry'
198

199
# A list of macros that should be interpreted as conditionals instead of as
200
# function calls.
201
IfMacros:
202
  - 'if_test'
203

204
# The maximum number of consecutive empty lines to keep.
205
MaxEmptyLinesToKeep: 1
206

207
# No empty line at the start of a block.
208
KeepEmptyLinesAtTheStartOfBlocks: false
209

210
# Penalties
211
# This decides what order things should be done if a line is too long
212
PenaltyBreakAssignment: 10
213
PenaltyBreakBeforeFirstCallParameter: 30
214
PenaltyBreakComment: 10
215
PenaltyBreakFirstLessLess: 0
216
PenaltyBreakString: 10
217
PenaltyExcessCharacter: 100
218
PenaltyReturnTypeOnItsOwnLine: 60
219

220
# Don't sort #include's
221
SortIncludes: false
222

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.