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.
11 AccessModifierOffset: -2
12 AlignAfterOpenBracket: Align
13 AlignConsecutiveAssignments: false
14 AlignConsecutiveDeclarations: false
15 AlignEscapedNewlines: DontAlign
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
42 AfterControlStatement: false
46 AfterObjCDeclaration: 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
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
70 ExperimentalAutoDetectBinPacking: false
71 ForEachMacros: [ foreach, BOOST_FOREACH ]
72 # FIXME: We should consider this.
73 FixNamespaceComments: false
75 # - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
77 # - Regex: '^(<|"(gtest|isl|json)/)'
81 IndentCaseLabels: true
83 IndentWrappedFunctionNames: false
84 KeepEmptyLinesAtTheStartOfBlocks: false
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.
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.
123 UseTab: ForContinuationAndIndentation