mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	
		
			
	
	
		
			167 lines
		
	
	
	
		
			4.3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
		
		
			
		
	
	
			167 lines
		
	
	
	
		
			4.3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| 
								 | 
							
								# Copied from https://github.com/git/git/blob/master/.clang-format
							 | 
						||
| 
								 | 
							
								# under GPL-2.0.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								UseTab: Always
							 | 
						||
| 
								 | 
							
								TabWidth: 8
							 | 
						||
| 
								 | 
							
								IndentWidth: 8
							 | 
						||
| 
								 | 
							
								ContinuationIndentWidth: 8
							 | 
						||
| 
								 | 
							
								ColumnLimit: 80
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# C Language specifics
							 | 
						||
| 
								 | 
							
								Language: Cpp
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Align parameters on the open bracket
							 | 
						||
| 
								 | 
							
								# someLongFunction(argument1,
							 | 
						||
| 
								 | 
							
								#                  argument2);
							 | 
						||
| 
								 | 
							
								AlignAfterOpenBracket: Align
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't align consecutive assignments
							 | 
						||
| 
								 | 
							
								# int aaaa = 12;
							 | 
						||
| 
								 | 
							
								# int b = 14;
							 | 
						||
| 
								 | 
							
								AlignConsecutiveAssignments: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't align consecutive declarations
							 | 
						||
| 
								 | 
							
								# int aaaa = 12;
							 | 
						||
| 
								 | 
							
								# double b = 3.14;
							 | 
						||
| 
								 | 
							
								AlignConsecutiveDeclarations: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Align escaped newlines as far left as possible
							 | 
						||
| 
								 | 
							
								# #define A   \
							 | 
						||
| 
								 | 
							
								#   int aaaa; \
							 | 
						||
| 
								 | 
							
								#   int b;    \
							 | 
						||
| 
								 | 
							
								#   int cccccccc;
							 | 
						||
| 
								 | 
							
								AlignEscapedNewlines: Left
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Align operands of binary and ternary expressions
							 | 
						||
| 
								 | 
							
								# int aaa = bbbbbbbbbbb +
							 | 
						||
| 
								 | 
							
								#           cccccc;
							 | 
						||
| 
								 | 
							
								AlignOperands: true
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't align trailing comments
							 | 
						||
| 
								 | 
							
								# int a; // Comment a
							 | 
						||
| 
								 | 
							
								# int b = 2; // Comment b
							 | 
						||
| 
								 | 
							
								AlignTrailingComments: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# By default don't allow putting parameters onto the next line
							 | 
						||
| 
								 | 
							
								# myFunction(foo, bar, baz);
							 | 
						||
| 
								 | 
							
								AllowAllParametersOfDeclarationOnNextLine: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't allow short braced statements to be on a single line
							 | 
						||
| 
								 | 
							
								# if (a)           not       if (a) return;
							 | 
						||
| 
								 | 
							
								#   return;
							 | 
						||
| 
								 | 
							
								AllowShortBlocksOnASingleLine: false
							 | 
						||
| 
								 | 
							
								AllowShortCaseLabelsOnASingleLine: false
							 | 
						||
| 
								 | 
							
								AllowShortFunctionsOnASingleLine: false
							 | 
						||
| 
								 | 
							
								AllowShortIfStatementsOnASingleLine: false
							 | 
						||
| 
								 | 
							
								AllowShortLoopsOnASingleLine: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# By default don't add a line break after the return type of top-level functions
							 | 
						||
| 
								 | 
							
								# int foo();
							 | 
						||
| 
								 | 
							
								AlwaysBreakAfterReturnType: None
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Pack as many parameters or arguments onto the same line as possible
							 | 
						||
| 
								 | 
							
								# int myFunction(int aaaaaaaaaaaa, int bbbbbbbb,
							 | 
						||
| 
								 | 
							
								#                int cccc);
							 | 
						||
| 
								 | 
							
								BinPackArguments: true
							 | 
						||
| 
								 | 
							
								BinPackParameters: true
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Attach braces to surrounding context except break before braces on function
							 | 
						||
| 
								 | 
							
								# definitions.
							 | 
						||
| 
								 | 
							
								# void foo()
							 | 
						||
| 
								 | 
							
								# {
							 | 
						||
| 
								 | 
							
								#    if (true) {
							 | 
						||
| 
								 | 
							
								#    } else {
							 | 
						||
| 
								 | 
							
								#    }
							 | 
						||
| 
								 | 
							
								# };
							 | 
						||
| 
								 | 
							
								BreakBeforeBraces: Linux
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Break after operators
							 | 
						||
| 
								 | 
							
								# int valuve = aaaaaaaaaaaaa +
							 | 
						||
| 
								 | 
							
								#              bbbbbb -
							 | 
						||
| 
								 | 
							
								#              ccccccccccc;
							 | 
						||
| 
								 | 
							
								BreakBeforeBinaryOperators: None
							 | 
						||
| 
								 | 
							
								BreakBeforeTernaryOperators: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't break string literals
							 | 
						||
| 
								 | 
							
								BreakStringLiterals: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Use the same indentation level as for the switch statement.
							 | 
						||
| 
								 | 
							
								# Switch statement body is always indented one level more than case labels.
							 | 
						||
| 
								 | 
							
								IndentCaseLabels: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't indent a function definition or declaration if it is wrapped after the
							 | 
						||
| 
								 | 
							
								# type
							 | 
						||
| 
								 | 
							
								IndentWrappedFunctionNames: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Align pointer to the right
							 | 
						||
| 
								 | 
							
								# int *a;
							 | 
						||
| 
								 | 
							
								PointerAlignment: Right
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't insert a space after a cast
							 | 
						||
| 
								 | 
							
								# x = (int32)y;    not    x = (int32) y;
							 | 
						||
| 
								 | 
							
								SpaceAfterCStyleCast: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Insert spaces before and after assignment operators
							 | 
						||
| 
								 | 
							
								# int a = 5;    not    int a=5;
							 | 
						||
| 
								 | 
							
								# a += 42;             a+=42;
							 | 
						||
| 
								 | 
							
								SpaceBeforeAssignmentOperators: true
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Put a space before opening parentheses only after control statement keywords.
							 | 
						||
| 
								 | 
							
								# void f() {
							 | 
						||
| 
								 | 
							
								#   if (true) {
							 | 
						||
| 
								 | 
							
								#     f();
							 | 
						||
| 
								 | 
							
								#   }
							 | 
						||
| 
								 | 
							
								# }
							 | 
						||
| 
								 | 
							
								SpaceBeforeParens: ControlStatements
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't insert spaces inside empty '()'
							 | 
						||
| 
								 | 
							
								SpaceInEmptyParentheses: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# The number of spaces before trailing line comments (// - comments).
							 | 
						||
| 
								 | 
							
								# This does not affect trailing block comments (/* - comments).
							 | 
						||
| 
								 | 
							
								SpacesBeforeTrailingComments: 1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't insert spaces in casts
							 | 
						||
| 
								 | 
							
								# x = (int32) y;    not    x = ( int32 ) y;
							 | 
						||
| 
								 | 
							
								SpacesInCStyleCastParentheses: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't insert spaces inside container literals
							 | 
						||
| 
								 | 
							
								# var arr = [1, 2, 3];    not    var arr = [ 1, 2, 3 ];
							 | 
						||
| 
								 | 
							
								SpacesInContainerLiterals: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't insert spaces after '(' or before ')'
							 | 
						||
| 
								 | 
							
								# f(arg);    not    f( arg );
							 | 
						||
| 
								 | 
							
								SpacesInParentheses: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't insert spaces after '[' or before ']'
							 | 
						||
| 
								 | 
							
								# int a[5];    not    int a[ 5 ];
							 | 
						||
| 
								 | 
							
								SpacesInSquareBrackets: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Insert a space after '{' and before '}' in struct initializers
							 | 
						||
| 
								 | 
							
								Cpp11BracedListStyle: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# A list of macros that should be interpreted as foreach loops instead of as
							 | 
						||
| 
								 | 
							
								# function calls.
							 | 
						||
| 
								 | 
							
								ForEachMacros:
							 | 
						||
| 
								 | 
							
								  - 'wl_list_for_each'
							 | 
						||
| 
								 | 
							
								  - 'wl_list_for_each_reverse'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# The maximum number of consecutive empty lines to keep.
							 | 
						||
| 
								 | 
							
								MaxEmptyLinesToKeep: 1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# No empty line at the start of a block.
							 | 
						||
| 
								 | 
							
								KeepEmptyLinesAtTheStartOfBlocks: false
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Penalties
							 | 
						||
| 
								 | 
							
								# This decides what order things should be done if a line is too long
							 | 
						||
| 
								 | 
							
								PenaltyBreakAssignment: 10
							 | 
						||
| 
								 | 
							
								PenaltyBreakBeforeFirstCallParameter: 30
							 | 
						||
| 
								 | 
							
								PenaltyBreakComment: 10
							 | 
						||
| 
								 | 
							
								PenaltyBreakFirstLessLess: 0
							 | 
						||
| 
								 | 
							
								PenaltyBreakString: 10
							 | 
						||
| 
								 | 
							
								PenaltyExcessCharacter: 100
							 | 
						||
| 
								 | 
							
								PenaltyReturnTypeOnItsOwnLine: 60
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# Don't sort #include's
							 | 
						||
| 
								 | 
							
								SortIncludes: false
							 |