1 # This file is an example configuration for clang-format 5.0.
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.
7 # Use tabs whenever we need to fill whitespace that spans at least from one tab
8 # stop to the next one.
10 # These settings are mirrored in .editorconfig. Keep them in sync.
14 ContinuationIndentWidth: 8
17 # C Language specifics
20 # Align parameters on the open bracket
21 # someLongFunction(argument1,
23 AlignAfterOpenBracket: Align
25 # Don't align consecutive assignments
28 AlignConsecutiveAssignments: false
30 # Don't align consecutive declarations
33 AlignConsecutiveDeclarations: false
35 # Align escaped newlines as far left as possible
40 AlignEscapedNewlines: Left
42 # Align operands of binary and ternary expressions
43 # int aaa = bbbbbbbbbbb +
47 # Don't align trailing comments
49 # int b = 2; // Comment b
50 AlignTrailingComments: false
52 # By default don't allow putting parameters onto the next line
53 # myFunction(foo, bar, baz);
54 AllowAllParametersOfDeclarationOnNextLine: false
56 # Don't allow short braced statements to be on a single line
57 # if (a) not if (a) return;
59 AllowShortBlocksOnASingleLine: false
60 AllowShortCaseLabelsOnASingleLine: false
61 AllowShortFunctionsOnASingleLine: false
62 AllowShortIfStatementsOnASingleLine: false
63 AllowShortLoopsOnASingleLine: false
65 # By default don't add a line break after the return type of top-level functions
67 AlwaysBreakAfterReturnType: None
69 # Pack as many parameters or arguments onto the same line as possible
70 # int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
72 BinPackArguments: true
73 BinPackParameters: true
75 # Attach braces to surrounding context except break before braces on function
83 BreakBeforeBraces: Linux
85 # Break after operators
86 # int valuve = aaaaaaaaaaaaa +
89 BreakBeforeBinaryOperators: None
90 BreakBeforeTernaryOperators: false
92 # Don't break string literals
93 BreakStringLiterals: false
95 # Use the same indentation level as for the switch statement.
96 # Switch statement body is always indented one level more than case labels.
97 IndentCaseLabels: false
99 # Don't indent a function definition or declaration if it is wrapped after the
101 IndentWrappedFunctionNames: false
103 # Align pointer to the right
105 PointerAlignment: Right
107 # Don't insert a space after a cast
108 # x = (int32)y; not x = (int32) y;
109 SpaceAfterCStyleCast: false
111 # Insert spaces before and after assignment operators
112 # int a = 5; not int a=5;
114 SpaceBeforeAssignmentOperators: true
116 # Put a space before opening parentheses only after control statement keywords.
122 SpaceBeforeParens: ControlStatements
124 # Don't insert spaces inside empty '()'
125 SpaceInEmptyParentheses: false
127 # The number of spaces before trailing line comments (// - comments).
128 # This does not affect trailing block comments (/* - comments).
129 SpacesBeforeTrailingComments: 1
131 # Don't insert spaces in casts
132 # x = (int32) y; not x = ( int32 ) y;
133 SpacesInCStyleCastParentheses: false
135 # Don't insert spaces inside container literals
136 # var arr = [1, 2, 3]; not var arr = [ 1, 2, 3 ];
137 SpacesInContainerLiterals: false
139 # Don't insert spaces after '(' or before ')'
140 # f(arg); not f( arg );
141 SpacesInParentheses: false
143 # Don't insert spaces after '[' or before ']'
144 # int a[5]; not int a[ 5 ];
145 SpacesInSquareBrackets: false
147 # Insert a space after '{' and before '}' in struct initializers
148 Cpp11BracedListStyle: false
150 # A list of macros that should be interpreted as foreach loops instead of as
152 ForEachMacros: ['for_each_string_list_item', 'for_each_wanted_builtin', 'for_each_builtin', 'for_each_ut']
154 # The maximum number of consecutive empty lines to keep.
155 MaxEmptyLinesToKeep: 1
157 # No empty line at the start of a block.
158 KeepEmptyLinesAtTheStartOfBlocks: false
161 # This decides what order things should be done if a line is too long
162 PenaltyBreakAssignment: 10
163 PenaltyBreakBeforeFirstCallParameter: 30
164 PenaltyBreakComment: 10
165 PenaltyBreakFirstLessLess: 0
166 PenaltyBreakString: 10
167 PenaltyExcessCharacter: 100
168 PenaltyReturnTypeOnItsOwnLine: 60
170 # Don't sort #include's