interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / .clang-format

228 lines · 6446 bytes Raw Blame History
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.
11UseTab: Always
12TabWidth: 8
13IndentWidth: 8
14ContinuationIndentWidth: 8
15
16# While we do want to enforce a character limit of 80 characters, we often
17# allow lines to overflow that limit to prioritize readability. Setting a
18# character limit here with penalties has been finicky and creates too many
19# false positives.
20#
21# NEEDSWORK: It would be nice if we can find optimal settings to ensure we
22# can re-enable the limit here.
23ColumnLimit: 0
24
25# C Language specifics
26Language: Cpp
27
28# Align parameters on the open bracket
29# someLongFunction(argument1,
30# argument2);
31AlignAfterOpenBracket: Align
32
33# Don't align consecutive assignments
34# int aaaa = 12;
35# int b = 14;
36AlignConsecutiveAssignments: false
37
38# Don't align consecutive declarations
39# int aaaa = 12;
40# double b = 3.14;
41AlignConsecutiveDeclarations: false
42
43# Align consecutive macro definitions.
44AlignConsecutiveMacros: true
45
46# Align escaped newlines as far left as possible
47# #define A \
48# int aaaa; \
49# int b; \
50# int cccccccc;
51AlignEscapedNewlines: Left
52
53# Align operands of binary and ternary expressions
54# int aaa = bbbbbbbbbbb +
55# cccccc;
56AlignOperands: true
57
58# Don't align trailing comments
59# int a; // Comment a
60# int b = 2; // Comment b
61AlignTrailingComments: false
62
63# By default don't allow putting parameters onto the next line
64# myFunction(foo, bar, baz);
65AllowAllParametersOfDeclarationOnNextLine: false
66
67# Don't allow short braced statements to be on a single line
68# if (a) not if (a) return;
69# return;
70AllowShortBlocksOnASingleLine: false
71AllowShortCaseLabelsOnASingleLine: false
72AllowShortFunctionsOnASingleLine: false
73AllowShortIfStatementsOnASingleLine: false
74AllowShortLoopsOnASingleLine: false
75
76# By default don't add a line break after the return type of top-level functions
77# int foo();
78AlwaysBreakAfterReturnType: None
79
80# Pack as many parameters or arguments onto the same line as possible
81# int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
82# int cccc);
83BinPackArguments: true
84BinPackParameters: true
85
86# Add no space around the bit field
87# unsigned bf:2;
88BitFieldColonSpacing: None
89
90# Attach braces to surrounding context except break before braces on function
91# definitions.
92# void foo()
93# {
94# if (true) {
95# } else {
96# }
97# };
98BreakBeforeBraces: Linux
99
100# Break after operators
101# int value = aaaaaaaaaaaaa +
102# bbbbbb -
103# ccccccccccc;
104BreakBeforeBinaryOperators: None
105BreakBeforeTernaryOperators: false
106
107# Don't break string literals
108BreakStringLiterals: false
109
110# Use the same indentation level as for the switch statement.
111# Switch statement body is always indented one level more than case labels.
112IndentCaseLabels: false
113
114# Indents directives before the hash. Each level uses a single space for
115# indentation.
116# #if FOO
117# # include <foo>
118# #endif
119IndentPPDirectives: AfterHash
120PPIndentWidth: 1
121
122# Don't indent a function definition or declaration if it is wrapped after the
123# type
124IndentWrappedFunctionNames: false
125
126# Align pointer to the right
127# int *a;
128PointerAlignment: Right
129
130# Don't insert a space after a cast
131# x = (int32)y; not x = (int32) y;
132SpaceAfterCStyleCast: false
133
134# No space is inserted after the logical not operator
135SpaceAfterLogicalNot: false
136
137# Insert spaces before and after assignment operators
138# int a = 5; not int a=5;
139# a += 42; a+=42;
140SpaceBeforeAssignmentOperators: true
141
142# Spaces will be removed before case colon.
143# case 1: break; not case 1 : break;
144SpaceBeforeCaseColon: false
145
146# Put a space before opening parentheses only after control statement keywords.
147# void f() {
148# if (true) {
149# f();
150# }
151# }
152SpaceBeforeParens: ControlStatementsExceptControlMacros
153
154# Don't insert spaces inside empty '()'
155SpaceInEmptyParentheses: false
156
157# No space before first '[' in arrays
158# int a[5][5]; not int a [5][5];
159SpaceBeforeSquareBrackets: false
160
161# No space will be inserted into {}
162# while (true) {} not while (true) { }
163SpaceInEmptyBlock: false
164
165# The number of spaces before trailing line comments (// - comments).
166# This does not affect trailing block comments (/* - comments).
167SpacesBeforeTrailingComments: 1
168
169# Don't insert spaces in casts
170# x = (int32) y; not x = ( int32 ) y;
171SpacesInCStyleCastParentheses: false
172
173# Don't insert spaces inside container literals
174# var arr = [1, 2, 3]; not var arr = [ 1, 2, 3 ];
175SpacesInContainerLiterals: false
176
177# Don't insert spaces after '(' or before ')'
178# f(arg); not f( arg );
179SpacesInParentheses: false
180
181# Don't insert spaces after '[' or before ']'
182# int a[5]; not int a[ 5 ];
183SpacesInSquareBrackets: false
184
185# Insert a space after '{' and before '}' in struct initializers
186Cpp11BracedListStyle: false
187
188# A list of macros that should be interpreted as foreach loops instead of as
189# function calls. Taken from:
190# git grep -h '^#define [^[:space:]]*for_\?each[^[:space:]]*(' |
191# sed "s/^#define / - '/; s/(.*$/'/" | sort | uniq
192ForEachMacros:
193 - 'for_each_builtin'
194 - 'for_each_string_list_item'
195 - 'for_each_ut'
196 - 'for_each_wanted_builtin'
197 - 'hashmap_for_each_entry'
198 - 'hashmap_for_each_entry_from'
199 - 'kh_foreach'
200 - 'kh_foreach_value'
201 - 'list_for_each'
202 - 'list_for_each_dir'
203 - 'list_for_each_prev'
204 - 'list_for_each_prev_safe'
205 - 'list_for_each_safe'
206 - 'strintmap_for_each_entry'
207 - 'strmap_for_each_entry'
208 - 'strset_for_each_entry'
209
210# A list of macros that should be interpreted as conditionals instead of as
211# function calls.
212IfMacros:
213 - 'if_test'
214
215# The maximum number of consecutive empty lines to keep.
216MaxEmptyLinesToKeep: 1
217
218# No empty line at the start of a block.
219KeepEmptyLinesAtTheStartOfBlocks: false
220
221# Don't sort #include's
222SortIncludes: false
223
224# Remove optional braces of control statements (if, else, for, and while)
225# according to the LLVM coding style. This avoids braces on simple
226# single-statement bodies of statements but keeps braces if one side of
227# if/else if/.../else cascade has multi-statement body.
228RemoveBracesLLVM: true