Merge github.com:helenos-xhci-team/helenos
[helenos.git] / .clang-format
blobb1d9dab8e2f0f879380e57543fd0ab13aa848326
1 # This format definition attempts to be as close to the style of existing
2 # HelenOS code as possible. However, there are several significant issues:
4 #    "AlignEscapedNewlines: DontAlign" currently hangs
5 #        the formatter on some files.
7 #    The formatter currently isn't able to align macro definitions,
8 #        and removes existing alignment in files.
9 #        (There is a patch for this, but it hasn't been integrated yet.)
11 #    SpacesBeforeTrailingComments don't apply to C-style comments.
13 #    enum definition is always crammed into a single line if it fits,
14 #        and there is no option to put members on separate lines.
16 #    Possibly others.
19 # Provisions are made to reformat the entire source tree via 'make format',
20 # but due to the above, this shouldn't be done except to evaluate the
21 # impact. Reformatting a single source file can be done using
23 #     clang-format -i source/file.c
25 ---
26 Language:        Cpp
27 BasedOnStyle:  LLVM
28 AccessModifierOffset: 0
29 AlignAfterOpenBracket: DontAlign
30 AlignConsecutiveAssignments: false
31 AlignConsecutiveDeclarations: false
32 AlignEscapedNewlines: Left
33 AlignOperands:   false
34 AlignTrailingComments: true
35 AllowAllParametersOfDeclarationOnNextLine: true
36 AllowShortBlocksOnASingleLine: false
37 AllowShortCaseLabelsOnASingleLine: false
38 AllowShortFunctionsOnASingleLine: None
39 AllowShortIfStatementsOnASingleLine: false
40 AllowShortLoopsOnASingleLine: false
41 AlwaysBreakAfterDefinitionReturnType: None
42 AlwaysBreakAfterReturnType: None
43 AlwaysBreakBeforeMultilineStrings: false
44 AlwaysBreakTemplateDeclarations: true
45 BinPackArguments: true
46 BinPackParameters: true
47 BraceWrapping:
48   AfterClass:      false
49   AfterControlStatement: false
50   AfterEnum:       false
51   AfterFunction:   true
52   AfterNamespace:  false
53   AfterObjCDeclaration: false
54   AfterStruct:     false
55   AfterUnion:      false
56   BeforeCatch:     false
57   BeforeElse:      false
58   IndentBraces:    false
59   SplitEmptyFunction: true
60   SplitEmptyRecord: true
61   SplitEmptyNamespace: true
62 BreakBeforeBinaryOperators: NonAssignment
63 BreakBeforeBraces: Custom
64 BreakBeforeInheritanceComma: true
65 BreakBeforeTernaryOperators: true
66 BreakConstructorInitializers: BeforeColon
67 BreakStringLiterals: true
68 ColumnLimit:     80
69 CompactNamespaces: false
70 ConstructorInitializerAllOnOneLineOrOnePerLine: false
71 ConstructorInitializerIndentWidth: 4
72 ContinuationIndentWidth: 4
73 Cpp11BracedListStyle: true
74 DerivePointerAlignment: false
75 FixNamespaceComments: true
76 ForEachMacros:
77   - foreach
78   - Q_FOREACH
79   - BOOST_FOREACH
80 IncludeCategories:
81   - Regex:           '^"'
82     Priority:        3
83   - Regex:           '^<'
84     Priority:        2
85   - Regex:           '.*'
86     Priority:        1
87 IncludeIsMainRegex: '(-test)?$'
88 IndentCaseLabels: false
89 IndentWidth:     8
90 IndentWrappedFunctionNames: false
91 KeepEmptyLinesAtTheStartOfBlocks: true
92 MacroBlockBegin: ''
93 MacroBlockEnd:   ''
94 MaxEmptyLinesToKeep: 1
95 NamespaceIndentation: None
96 PenaltyBreakAssignment: 2
97 PenaltyBreakBeforeFirstCallParameter: 19
98 PenaltyBreakComment: 300
99 PenaltyBreakFirstLessLess: 120
100 PenaltyBreakString: 1000
101 PenaltyExcessCharacter: 1000000
102 PenaltyReturnTypeOnItsOwnLine: 60
103 PointerAlignment: Right
104 ReflowComments:  true
105 SortIncludes:    true
106 SortUsingDeclarations: true
107 SpaceAfterCStyleCast: true
108 SpaceAfterTemplateKeyword: false
109 SpaceBeforeAssignmentOperators: true
110 SpaceBeforeParens: ControlStatements
111 SpaceInEmptyParentheses: false
112 SpacesBeforeTrailingComments: 2
113 SpacesInAngles:  false
114 SpacesInContainerLiterals: false
115 SpacesInCStyleCastParentheses: false
116 SpacesInParentheses: false
117 SpacesInSquareBrackets: false
118 Standard:        Cpp11
119 TabWidth:        8
120 UseTab:          ForIndentation