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.
12 ContinuationIndentWidth: 8
15 # C Language specifics
18 # Align parameters on the open bracket
19 # someLongFunction(argument1,
21 AlignAfterOpenBracket: Align
23 # Don't align consecutive assignments
26 AlignConsecutiveAssignments: false
28 # Don't align consecutive declarations
31 AlignConsecutiveDeclarations: false
33 # Align escaped newlines as far left as possible
38 AlignEscapedNewlines: Left
40 # Align operands of binary and ternary expressions
41 # int aaa = bbbbbbbbbbb +
45 # Don't align trailing comments
47 # int b = 2; // Comment b
48 AlignTrailingComments: false
50 # By default don't allow putting parameters onto the next line
51 # myFunction(foo, bar, baz);
52 AllowAllParametersOfDeclarationOnNextLine: false
54 # Don't allow short braced statements to be on a single line
55 # if (a) not if (a) return;
57 AllowShortBlocksOnASingleLine: false
58 AllowShortCaseLabelsOnASingleLine: false
59 AllowShortFunctionsOnASingleLine: false
60 AllowShortIfStatementsOnASingleLine: false
61 AllowShortLoopsOnASingleLine: false
63 # By default don't add a line break after the return type of top-level functions
65 AlwaysBreakAfterReturnType: None
67 # Pack as many parameters or arguments onto the same line as possible
68 # int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
70 BinPackArguments: true
71 BinPackParameters: true
73 # Attach braces to surrounding context except break before braces on function
81 BreakBeforeBraces: Linux
83 # Break after operators
84 # int valuve = aaaaaaaaaaaaa +
87 BreakBeforeBinaryOperators: None
88 BreakBeforeTernaryOperators: false
90 # Don't break string literals
91 BreakStringLiterals: false
93 # Use the same indentation level as for the switch statement.
94 # Switch statement body is always indented one level more than case labels.
95 IndentCaseLabels: false
97 # Don't indent a function definition or declaration if it is wrapped after the
99 IndentWrappedFunctionNames: false
101 # Align pointer to the right
103 PointerAlignment: Right
105 # Don't insert a space after a cast
106 # x = (int32)y; not x = (int32) y;
107 SpaceAfterCStyleCast: false
109 # Insert spaces before and after assignment operators
110 # int a = 5; not int a=5;
112 SpaceBeforeAssignmentOperators: true
114 # Put a space before opening parentheses only after control statement keywords.
120 SpaceBeforeParens: ControlStatements
122 # Don't insert spaces inside empty '()'
123 SpaceInEmptyParentheses: false
125 # The number of spaces before trailing line comments (// - comments).
126 # This does not affect trailing block comments (/* - comments).
127 SpacesBeforeTrailingComments: 1
129 # Don't insert spaces in casts
130 # x = (int32) y; not x = ( int32 ) y;
131 SpacesInCStyleCastParentheses: false
133 # Don't insert spaces inside container literals
134 # var arr = [1, 2, 3]; not var arr = [ 1, 2, 3 ];
135 SpacesInContainerLiterals: false
137 # Don't insert spaces after '(' or before ')'
138 # f(arg); not f( arg );
139 SpacesInParentheses: false
141 # Don't insert spaces after '[' or before ']'
142 # int a[5]; not int a[ 5 ];
143 SpacesInSquareBrackets: false
145 # Insert a space after '{' and before '}' in struct initializers
146 Cpp11BracedListStyle: false
148 # A list of macros that should be interpreted as foreach loops instead of as
150 ForEachMacros: ['for_each_string_list_item']
152 # The maximum number of consecutive empty lines to keep.
153 MaxEmptyLinesToKeep: 1
155 # No empty line at the start of a block.
156 KeepEmptyLinesAtTheStartOfBlocks: false
159 # This decides what order things should be done if a line is too long
160 PenaltyBreakAssignment: 10
161 PenaltyBreakBeforeFirstCallParameter: 30
162 PenaltyBreakComment: 10
163 PenaltyBreakFirstLessLess: 0
164 PenaltyBreakString: 10
165 PenaltyExcessCharacter: 100
166 PenaltyReturnTypeOnItsOwnLine: 5
168 # Don't sort #include's