git-gc.txt: fix typo about gc.writeCommitGraph
[git.git] / .clang-format
blobde1c8b5c77f7566d9e41949e5e397db3cc1b487c
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.
11 UseTab: Always
12 TabWidth: 8
13 IndentWidth: 8
14 ContinuationIndentWidth: 8
15 ColumnLimit: 80
17 # C Language specifics
18 Language: Cpp
20 # Align parameters on the open bracket
21 # someLongFunction(argument1,
22 #                  argument2);
23 AlignAfterOpenBracket: Align
25 # Don't align consecutive assignments
26 # int aaaa = 12;
27 # int b = 14;
28 AlignConsecutiveAssignments: false
30 # Don't align consecutive declarations
31 # int aaaa = 12;
32 # double b = 3.14;
33 AlignConsecutiveDeclarations: false
35 # Align escaped newlines as far left as possible
36 # #define A   \
37 #   int aaaa; \
38 #   int b;    \
39 #   int cccccccc;
40 AlignEscapedNewlines: Left
42 # Align operands of binary and ternary expressions
43 # int aaa = bbbbbbbbbbb +
44 #           cccccc;
45 AlignOperands: true
47 # Don't align trailing comments
48 # int a; // Comment a
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;
58 #   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
66 # int foo();
67 AlwaysBreakAfterReturnType: None
69 # Pack as many parameters or arguments onto the same line as possible
70 # int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
71 #                int cccc);
72 BinPackArguments: true
73 BinPackParameters: true
75 # Attach braces to surrounding context except break before braces on function
76 # definitions.
77 # void foo()
78 # {
79 #    if (true) {
80 #    } else {
81 #    }
82 # };
83 BreakBeforeBraces: Linux
85 # Break after operators
86 # int valuve = aaaaaaaaaaaaa +
87 #              bbbbbb -
88 #              ccccccccccc;
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
100 # type
101 IndentWrappedFunctionNames: false
103 # Align pointer to the right
104 # int *a;
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;
113 # a += 42;             a+=42;
114 SpaceBeforeAssignmentOperators: true
116 # Put a space before opening parentheses only after control statement keywords.
117 # void f() {
118 #   if (true) {
119 #     f();
120 #   }
121 # }
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
151 # function calls.
152 ForEachMacros: ['for_each_string_list_item']
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
160 # Penalties
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
171 SortIncludes: false