THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
5.0KB

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