Clarify docs of $sort n and u options
[xapian.git] / .clang-format
blob6810ff6553477ebef84774489992f36e6d93a742
1 # Experimental.
3 # This configuration attempts to match Xapian coding conventions but it's
4 # currently a work-in-progress.
6 # It should be used in conjunction with
7 # xapian-maintainer-tools/run-clang-format (which undoes some unhelpful
8 # changes) and the results should be manually checked before committing.
9 ---
10 Language:        Cpp
11 AccessModifierOffset: -2
12 AlignAfterOpenBracket: Align
13 AlignConsecutiveAssignments: false
14 AlignConsecutiveDeclarations: false
15 AlignEscapedNewlines: DontAlign
16 AlignOperands: true
17 AlignTrailingComments: false
18 AllowAllParametersOfDeclarationOnNextLine: true
19 AllowShortBlocksOnASingleLine: false
20 AllowShortCaseLabelsOnASingleLine: false
21 # FIXME: InlineOnly supported by newer clang-format
22 AllowShortFunctionsOnASingleLine: Inline
23 # Traditional Xapian style is that this is OK for simple statements, but
24 # clang-format's option aggressively reformats any statement short enough to
25 # fit on the same line.  Given we have to choose, let's go for not allowing
26 # this ever - if nothing else, it makes it much clearer if the branch is ever
27 # taken in code coverage reports.
28 AllowShortIfStatementsOnASingleLine: false
29 # Traditional Xapian style is that this is OK for simple statements, but
30 # clang-format's option aggressively reformats any statement short enough to
31 # fit on the same line.  Given we have to choose, let's go for not allowing
32 # this ever - if nothing else, it makes it much clearer if the branch is ever
33 # taken in code coverage reports.
34 AllowShortLoopsOnASingleLine: false
35 AlwaysBreakAfterReturnType: TopLevelDefinitions
36 AlwaysBreakBeforeMultilineStrings: false
37 AlwaysBreakTemplateDeclarations: true
38 BinPackArguments: false
39 BinPackParameters: false
40 BraceWrapping:
41   AfterClass:      false
42   AfterControlStatement: false
43   AfterEnum:       false
44   AfterFunction:   true
45   AfterNamespace:  false
46   AfterObjCDeclaration: false
47   AfterStruct:     false
48   AfterUnion:      false
49   BeforeCatch:     false
50   BeforeElse:      false
51   IndentBraces:    false
52   # Needs > clang-format 3.8, and seems to default to true.
53   # SplitEmptyFunctionBody: true
54 BreakBeforeBinaryOperators: None
55 BreakBeforeBraces: Custom
56 BreakBeforeInheritanceComma: false
57 BreakBeforeTernaryOperators: false
58 BreakConstructorInitializersBeforeComma: false
59 BreakStringLiterals: true
60 ColumnLimit:     80
61 # Don't wrap copyright statements in comments.
62 CommentPragmas:  '^ Copyright '
63 CompactNamespaces: false
64 ConstructorInitializerAllOnOneLineOrOnePerLine: false
65 ConstructorInitializerIndentWidth: 4
66 ContinuationIndentWidth: 4
67 Cpp11BracedListStyle: false
68 DerivePointerAlignment: false
69 DisableFormat:   false
70 ExperimentalAutoDetectBinPacking: false
71 ForEachMacros:   [ foreach, BOOST_FOREACH ]
72 # FIXME: We should consider this.
73 FixNamespaceComments: false
74 #IncludeCategories:
75 #  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
76 #    Priority:        2
77 #  - Regex:           '^(<|"(gtest|isl|json)/)'
78 #    Priority:        3
79 #  - Regex:           '.*'
80 #    Priority:        1
81 IndentCaseLabels: true
82 IndentWidth:     4
83 IndentWrappedFunctionNames: false
84 KeepEmptyLinesAtTheStartOfBlocks: false
85 Language: Cpp
86 MacroBlockBegin: ''
87 MacroBlockEnd:   ''
88 MaxEmptyLinesToKeep: 1
89 NamespaceIndentation: None
90 ObjCBlockIndentWidth: 4
91 ObjCSpaceAfterProperty: true
92 ObjCSpaceBeforeProtocolList: true
93 # FIXME: These may benefit from tuning.
94 PenaltyBreakAssignment: 1
95 PenaltyBreakBeforeFirstCallParameter: 10000
96 PenaltyBreakComment: 300
97 PenaltyBreakFirstLessLess: 120
98 PenaltyBreakString: 1000
99 PenaltyExcessCharacter: 1000000
100 PenaltyReturnTypeOnItsOwnLine: 0
101 # We haven't historically really had a standard here, so go with what seems
102 # conventional in C++ code.
103 PointerAlignment: Left
104 ReflowComments:  false
105 # FIXME: Sort out configuration for sorting includes.
106 SortIncludes:    false
107 # FIXME: Only supported by newer clang-format
108 #SortUsingDeclarations: true
109 SpaceAfterCStyleCast: false
110 SpaceAfterTemplateKeyword: false
111 SpaceBeforeAssignmentOperators: true
112 SpaceBeforeParens: ControlStatements
113 SpaceInEmptyParentheses: false
114 SpacesBeforeTrailingComments: 1
115 SpacesInAngles:  false
116 SpacesInCStyleCastParentheses: false
117 SpacesInContainerLiterals: true
118 SpacesInParentheses: false
119 SpacesInSquareBrackets: false
120 # External API headers should be Cpp03, at least for now.
121 Standard:        Cpp11
122 TabWidth:        8
123 UseTab:          ForContinuationAndIndentation