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. 9UseTab: Always 10TabWidth: 8 11IndentWidth: 8 12ContinuationIndentWidth: 8 13ColumnLimit: 80 14 15# C Language specifics 16Language: Cpp 17 18# Align parameters on the open bracket 19# someLongFunction(argument1, 20# argument2); 21AlignAfterOpenBracket: Align 22 23# Don't align consecutive assignments 24# int aaaa = 12; 25# int b = 14; 26AlignConsecutiveAssignments: false 27 28# Don't align consecutive declarations 29# int aaaa = 12; 30# double b = 3.14; 31AlignConsecutiveDeclarations: false 32 33# Align escaped newlines as far left as possible 34# #define A \ 35# int aaaa; \ 36# int b; \ 37# int cccccccc; 38AlignEscapedNewlines: Left 39 40# Align operands of binary and ternary expressions 41# int aaa = bbbbbbbbbbb + 42# cccccc; 43AlignOperands: true 44 45# Don't align trailing comments 46# int a; // Comment a 47# int b = 2; // Comment b 48AlignTrailingComments: false 49 50# By default don't allow putting parameters onto the next line 51# myFunction(foo, bar, baz); 52AllowAllParametersOfDeclarationOnNextLine: false 53 54# Don't allow short braced statements to be on a single line 55# if (a) not if (a) return; 56# return; 57AllowShortBlocksOnASingleLine: false 58AllowShortCaseLabelsOnASingleLine: false 59AllowShortFunctionsOnASingleLine: false 60AllowShortIfStatementsOnASingleLine: false 61AllowShortLoopsOnASingleLine: false 62 63# By default don't add a line break after the return type of top-level functions 64# int foo(); 65AlwaysBreakAfterReturnType: None 66 67# Pack as many parameters or arguments onto the same line as possible 68# int myFunction(int aaaaaaaaaaaa, int bbbbbbbb, 69# int cccc); 70BinPackArguments: true 71BinPackParameters: true 72 73# Attach braces to surrounding context except break before braces on function 74# definitions. 75# void foo() 76# { 77# if (true) { 78# } else { 79# } 80# }; 81BreakBeforeBraces: Linux 82 83# Break after operators 84# int valuve = aaaaaaaaaaaaa + 85# bbbbbb - 86# ccccccccccc; 87BreakBeforeBinaryOperators: None 88BreakBeforeTernaryOperators: false 89 90# Don't break string literals 91BreakStringLiterals: false 92 93# Use the same indentation level as for the switch statement. 94# Switch statement body is always indented one level more than case labels. 95IndentCaseLabels: false 96 97# Don't indent a function definition or declaration if it is wrapped after the 98# type 99IndentWrappedFunctionNames: false 100 101# Align pointer to the right 102# int *a; 103PointerAlignment: Right 104 105# Don't insert a space after a cast 106# x = (int32)y; not x = (int32) y; 107SpaceAfterCStyleCast: false 108 109# Insert spaces before and after assignment operators 110# int a = 5; not int a=5; 111# a += 42; a+=42; 112SpaceBeforeAssignmentOperators: true 113 114# Put a space before opening parentheses only after control statement keywords. 115# void f() { 116# if (true) { 117# f(); 118# } 119# } 120SpaceBeforeParens: ControlStatements 121 122# Don't insert spaces inside empty '()' 123SpaceInEmptyParentheses: false 124 125# The number of spaces before trailing line comments (// - comments). 126# This does not affect trailing block comments (/* - comments). 127SpacesBeforeTrailingComments: 1 128 129# Don't insert spaces in casts 130# x = (int32) y; not x = ( int32 ) y; 131SpacesInCStyleCastParentheses: false 132 133# Don't insert spaces inside container literals 134# var arr = [1, 2, 3]; not var arr = [ 1, 2, 3 ]; 135SpacesInContainerLiterals: false 136 137# Don't insert spaces after '(' or before ')' 138# f(arg); not f( arg ); 139SpacesInParentheses: false 140 141# Don't insert spaces after '[' or before ']' 142# int a[5]; not int a[ 5 ]; 143SpacesInSquareBrackets: false 144 145# Insert a space after '{' and before '}' in struct initializers 146Cpp11BracedListStyle: false 147 148# A list of macros that should be interpreted as foreach loops instead of as 149# function calls. 150ForEachMacros: ['for_each_string_list_item'] 151 152# The maximum number of consecutive empty lines to keep. 153MaxEmptyLinesToKeep: 1 154 155# No empty line at the start of a block. 156KeepEmptyLinesAtTheStartOfBlocks: false 157 158# Penalties 159# This decides what order things should be done if a line is too long 160PenaltyBreakAssignment: 10 161PenaltyBreakBeforeFirstCallParameter: 30 162PenaltyBreakComment: 10 163PenaltyBreakFirstLessLess: 0 164PenaltyBreakString: 10 165PenaltyExcessCharacter: 100 166PenaltyReturnTypeOnItsOwnLine: 60 167 168# Don't sort #include's 169SortIncludes: false