1# Run command below to format a file
2# clang-format -i --style=file <file>
3
4# complete clang-format rule, reference:
5# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
6
7# WebKit format rule details, reference:
8#   https://webkit.org/code-style-guidelines/
9#   https://gitee.com/mirrors/WebKit/blob/main/.clang-format
10BasedOnStyle: Webkit
11# works on C and C++ files
12Language: Cpp
13
14PointerAlignment: Right
15AlignTrailingComments: true
16AlignConsecutiveMacros: Consecutive
17# case statements indent one layer
18IndentCaseLabels: true
19BreakBeforeBinaryOperators: None
20SpaceBeforeParens: ControlStatementsExceptControlMacros
21SpacesInCStyleCastParentheses: false
22AlignEscapedNewlines: Left
23NamespaceIndentation: None
24FixNamespaceComments: true
25BreakConstructorInitializers: AfterColon
26AlignArrayOfStructures: Left
27AllowShortFunctionsOnASingleLine: Empty
28AllowShortLambdasOnASingleLine: Empty
29AlwaysBreakTemplateDeclarations: true
30BreakBeforeTernaryOperators: false
31SpaceAroundPointerQualifiers: Both
32# iterator macros declaretion,avoid being treated as function call
33ForEachMacros:
34  - 'LIST_FOR_EACH_ENTRY'
35  - 'LIST_FOR_EACH_ENTRY_SAFE'
36  - 'LIST_FOR_EACH'
37  - 'LIST_FOR_EACH_SAFE'
38SortIncludes: CaseInsensitive
39AllowShortEnumsOnASingleLine: false
40ColumnLimit: 120