123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- ---
- # 语言: None, Cpp, Java, JavaScript, ObjC, Proto, TableGen, TextProto
- Language: Cpp
- BasedOnStyle: Google
- # 访问说明符(public、private等)的偏移
- AccessModifierOffset: -4
- # 开括号(开圆括号、开尖括号、开方括号)后的对齐: Align, DontAlign, AlwaysBreak(总是在开括号后换行)
- AlignAfterOpenBracket: Align
- # 对齐数组列
- AlignArrayOfStructures: None
- # 对齐连续宏定义
- AlignConsecutiveMacros: #AcrossEmptyLinesAndComments
- Enabled: true
- AcrossEmptyLines: true
- AcrossComments: false
- AlignCompound: false
- PadOperators: false
- # 连续赋值时,对齐所有等号
- AlignConsecutiveAssignments:
- Enabled: true
- AcrossEmptyLines: false
- AcrossComments: false
- AlignCompound: false
- PadOperators: false
- # 对齐连续位字段
- AlignConsecutiveBitFields:
- Enabled: true
- AcrossEmptyLines: false
- AcrossComments: false
- AlignCompound: false
- PadOperators: false
- # 连续声明时,对齐所有声明的变量名
- AlignConsecutiveDeclarations:
- Enabled: true
- AcrossEmptyLines: false
- AcrossComments: false
- AlignCompound: false
- PadOperators: false
- # 左对齐逃脱换行(使用反斜杠换行)的反斜杠
- AlignEscapedNewlines: Left
- # 水平对齐二元和三元表达式的操作数
- AllowAllArgumentsOnNextLine: true
- AllowAllConstructorInitializersOnNextLine: true
- AlwaysBreakAfterDefinitionReturnType: None
- AlignOperands: true #Align
- # 对齐连续的尾随的注释
- AlignTrailingComments: true
- # 允许函数声明的所有参数在放在下一行
- AllowAllParametersOfDeclarationOnNextLine: false
- # 允许短的枚举放在同一行
- AllowShortEnumsOnASingleLine: true
- # 允许短的块放在同一行
- AllowShortBlocksOnASingleLine: Never
- # 允许短的case标签放在同一行
- AllowShortCaseLabelsOnASingleLine: false
- # 允许短的函数放在同一行
- AllowShortFunctionsOnASingleLine: false #All
- # 允许短的匿名函数放在同一行
- AllowShortLambdasOnASingleLine: All
- # 允许短的if语句保持在同一行
- AllowShortIfStatementsOnASingleLine: Never
- # 允许短的循环保持在同一行
- AllowShortLoopsOnASingleLine: false
- # 总是在返回类型后换行
- AlwaysBreakAfterReturnType: None
- # 总是在多行string字面量前换行
- AlwaysBreakBeforeMultilineStrings: false
- # 总是在template声明后换行
- AlwaysBreakTemplateDeclarations: MultiLine
- # 属性声明相关配置
- AttributeMacros:
- - __capability
- # false表示函数实参要么都在同一行,要么都各自一行
- BinPackArguments: true
- # false表示所有形参要么都在同一行,要么都各自一行
- BinPackParameters: true
- # 是否允许短方法单行,只有一行的函数将不会分行,直接写在函数名后
- # 括号是分行,还是不分行,只有当 BreakBeforeBraces 设置为 Custom 时才有效
- BraceWrapping:
- AfterCaseLabel: true
- # class 定义后面
- AfterClass: true
- # 控制语句后面
- AfterControlStatement: true
- AfterEnum: true
- AfterFunction: true
- AfterNamespace: true
- AfterObjCDeclaration: true
- AfterStruct: true
- AfterUnion: true
- AfterExternBlock: false
- BeforeCatch: true
- BeforeElse: true
- # 缩进大括号
- IndentBraces: false
- SplitEmptyFunction: true
- SplitEmptyRecord: true
- SplitEmptyNamespace: true
- BreakBeforeBinaryOperators: None
- # BreakAfterAttributes: Never
- # BreakArrays: true
- # BreakBeforeConceptDeclarations: Always
- BreakBeforeBraces: Custom
- BreakBeforeInheritanceComma: false
- BreakInheritanceList: BeforeColon
- # 三元运算符换行后在前
- BreakBeforeTernaryOperators: true
- BreakConstructorInitializersBeforeComma: false
- # 构造函数初始化列表换行规则
- BreakConstructorInitializers: BeforeColon
- BreakAfterJavaFieldAnnotations: false
- BreakStringLiterals: true
- # 代码最大列数
- ColumnLimit: 0
- CommentPragmas: "^ IWYU pragma:"
- CompactNamespaces: false
- ConstructorInitializerAllOnOneLineOrOnePerLine: false
- # 构造函数初始化列表和继承列表换行后缩进的字符数,无符号整数。
- ConstructorInitializerIndentWidth: 4
- # 当一行代码放不下,自动换行后的缩进
- ContinuationIndentWidth: 4
- # 大括号列表附近是否有空格{ 1, 2 }/{1, 2}
- Cpp11BracedListStyle: true
- DeriveLineEnding: true
- DerivePointerAlignment: false
- # 设置位false后可以使用// clang-format off .. // clang-format on注释禁用某段代码格式化
- DisableFormat: false
- # 类中访问修饰符后放置空行
- EmptyLineAfterAccessModifier: Never
- # 类中访问修饰符之前放置空行
- EmptyLineBeforeAccessModifier: LogicalBlock
- ExperimentalAutoDetectBinPacking: false
- # 自动修复命名空间注释名称
- FixNamespaceComments: true
- ForEachMacros:
- - forever
- - foreach
- - Q_FOREACH
- - BOOST_FOREACH
- IfMacros:
- - KJ_IF_MAYBE
- # 头文件分类排序
- IncludeBlocks: Preserve
- IncludeCategories:
- - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
- Priority: 2
- SortPriority: 0
- - Regex: '^(<|"(gtest|gmock|isl|json)/)'
- Priority: 3
- SortPriority: 0
- - Regex: ".*"
- Priority: 1
- SortPriority: 0
- IncludeIsMainRegex: "(Test)?$"
- IncludeIsMainSourceRegex: ""
- # 指定访问修饰符是否应具有自己的缩进级别
- IndentAccessModifiers: false
- # case的{}缩进
- IndentCaseBlocks: true
- # case的标签是否缩进
- IndentCaseLabels: true
- IndentExternBlock: AfterExternBlock
- IndentGotoLabels: true
- # 预处理器指令缩进样式
- IndentPPDirectives: None
- IndentRequiresClause: true
- # 换行缩进字符数
- IndentWidth: 4
- IndentWrappedFunctionNames: false
- # 控制语句(if、else、for、do和while)后面自动插入大括号(危险,可能导致代码错误)
- InsertBraces: false
- # InsertNewlineAtEOF: false
- # 仅适用于 JavaScript
- # InsertTrailingCommas: None
- # IntegerLiteralSeparator: # 格式化整数文字分隔符
- # Binary: 4 # 二进制文本中的分隔符格式,按4位分割
- # BinaryMinDigits: 0 # 达到多少位二进制文本才进行分割
- # Decimal: 3 # 以十进制文字格式设置分隔符的格式。
- # DecimalMinDigits: 0 # 十进制最小分割位数
- # Hex: 2 # 十六进制文字格式分割个数
- # HexMinDigits: 0
- JavaScriptQuotes: Leave
- JavaScriptWrapImports: true
- KeepEmptyLinesAtTheStartOfBlocks: true
- # lambda表达式换行、缩进样式样式
- LambdaBodyIndentation: Signature
- # 换行符样式
- # LineEnding: DeriveLF
- MacroBlockBegin: ""
- MacroBlockEnd: ""
- # 要保留的最大连续空行数
- MaxEmptyLinesToKeep: 1
- # 命名空间缩进
- NamespaceIndentation: None
- ObjCBinPackProtocolList: Auto
- ObjCBlockIndentWidth: 0
- ObjCBreakBeforeNestedBlockParam: true
- ObjCSpaceAfterProperty: false
- ObjCSpaceBeforeProtocolList: true
- # 设置初始化列表,和BreakConstructorInitializers 有一定冲突
- PackConstructorInitializers: BinPack
- PenaltyBreakAssignment: 2
- PenaltyBreakBeforeFirstCallParameter: 19
- PenaltyBreakComment: 300
- PenaltyBreakFirstLessLess: 120
- PenaltyBreakString: 1000
- PenaltyBreakTemplateDeclaration: 10
- PenaltyExcessCharacter: 1000000
- PenaltyReturnTypeOnItsOwnLine: 60
- # 指针对齐风格
- PointerAlignment: Right
- ReflowComments: true
- PPIndentWidth: -1
- # 不同的排列说明符和限定符的方法(危险,可能改变代码含义)
- QualifierAlignment: Leave
- # 引用对齐风格
- # ReferenceAlignment: Pointer
- # RemoveBracesLLVM: false
- # RemoveSemicolon: false
- # RequiresClausePosition: OwnLine
- # RequiresExpressionIndentation: OuterScope
- # 指定使用空行分隔定义块,包括 类、结构、枚举和函数。
- SeparateDefinitionBlocks: Always
- ShortNamespaceLines: 1
- # 头文件排序规则
- SortIncludes: CaseSensitive
- SortJavaStaticImport: Before
- # using声明排序 Lexicographic
- SortUsingDeclarations: true
- # 定义在哪些情况下在左括号之前放置空格
- SpaceBeforeParens: Custom
- # 在C语言风格的强制类型转换后插入空格
- SpaceAfterCStyleCast: true
- # 不在逻辑运算符 !后插入控制
- SpaceAfterLogicalNot: false
- SpaceAfterTemplateKeyword: true
- SpaceAroundPointerQualifiers: Default
- # 赋值运算符前是否有空格
- SpaceBeforeAssignmentOperators: true
- # case的:前是否有空格
- SpaceBeforeCaseColon: false
- # 调用构造函数时初始化列表的大括号前面是否有空格
- SpaceBeforeCpp11BracedList: false
- # 构造函数的:前面是否有空格
- SpaceBeforeCtorInitializerColon: true
- # 继承的:前面是否有空格
- SpaceBeforeInheritanceColon: true
- # 函数调用时括号前添加空格
- # SpaceBeforeParentheses: true
- # 括号内部添加空格
- SpacesInParentheses: false
- # 范围的for循环冒号之前删除空格
- SpaceBeforeRangeBasedForLoopColon: true
- SpaceInEmptyBlock: false
- SpaceInEmptyParentheses: false
- # 尾部//注释之前的空格
- SpacesBeforeTrailingComments: 1
- SpacesInAngles: false
- SpacesInConditionalStatement: false
- SpacesInContainerLiterals: true
- SpacesInCStyleCastParentheses: false
- SpacesInSquareBrackets: false
- # 不在[前添加空格
- SpaceBeforeSquareBrackets: false
- # 单独控制不同情况下括号前面的空格,在SpaceBeforeParens==Custom时生效
- SpaceBeforeParensOptions:
- AfterControlStatements: true
- AfterForeachMacros: true
- AfterFunctionDefinitionName: false
- AfterFunctionDeclarationName: false
- AfterIfMacros: true
- AfterOverloadedOperator: true
- AfterRequiresInClause: true
- AfterRequiresInExpression: true
- BeforeNonEmptyParentheses: true
- # 位域:每边都添加空格
- BitFieldColonSpacing: Both
- # 标准 解析和格式化与此标准兼容的c++结构
- Standard: Latest
- # 在语句前面被忽略的宏定义,就好像它们是一个属性一样
- StatementAttributeLikeMacros:
- - Q_EMIT
- # 应该被解释为完整语句的宏定义
- StatementMacros:
- - Q_UNUSED
- - QT_REQUIRE_VERSION
- - Q_CLASSINFO
- - Q_ENUM
- - Q_ENUM_NS
- - Q_FLAG
- - Q_FLAG_NS
- - Q_GADGET
- - Q_GADGET_EXPORT
- - Q_INTERFACES
- - Q_MOC_INCLUDE
- - Q_NAMESPACE
- - Q_NAMESPACE_EXPORT
- - Q_OBJECT
- - Q_PROPERTY
- - Q_REVISION
- - Q_DISABLE_COPY
- - Q_SET_OBJECT_NAME
- - QT_BEGIN_NAMESPACE
- - QT_END_NAMESPACE
- - QML_ADDED_IN_MINOR_VERSION
- - QML_ANONYMOUS
- - QML_ATTACHED
- - QML_DECLARE_TYPE
- - QML_DECLARE_TYPEINFO
- - QML_ELEMENT
- - QML_EXTENDED
- - QML_EXTENDED_NAMESPACE
- - QML_EXTRA_VERSION
- - QML_FOREIGN
- - QML_FOREIGN_NAMESPACE
- - QML_IMPLEMENTS_INTERFACES
- - QML_INTERFACE
- - QML_NAMED_ELEMENT
- - QML_REMOVED_IN_MINOR_VERSION
- - QML_SINGLETON
- - QML_UNAVAILABLE
- - QML_UNCREATABLE
- - QML_VALUE_TYPE
- # tab宽度
- TabWidth: 4
- # 使用\n换行
- UseCRLF: false
- # 使用tab字符:ForIndentation——仅将制表符用于缩进
- UseTab: Never
- # 对空格敏感的宏定义
- WhitespaceSensitiveMacros:
- - STRINGIZE
- - PP_STRINGIZE
- - BOOST_PP_STRINGIZE
- - NS_SWIFT_NAME
- - CF_SWIFT_NAME
- ---
|