1--- 2# Ref: https://releases.llvm.org/12.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html 3Checks: > 4 bugprone-*, 5 clang-analyzer-*, 6 concurrency-mt-unsafe, 7 cppcoreguidelines-*, 8 cert-* 9 hicpp-*, 10 llvm-*, 11 modernize*, 12 performance-*, 13 portability-*, 14 readability-*, 15 -modernize-use-trailing-return-type, 16 -hicpp-vararg, 17 -hicpp-no-array-decay, 18 -cppcoreguidelines-owning-memory, 19 -cppcoreguidelines-pro-bounds-array-to-pointer-decay, 20 -cppcoreguidelines-pro-type-union-access, 21 -cppcoreguidelines-pro-type-vararg, 22 -readability-implicit-bool-conversion, 23 24CheckOptions: 25 # Ref: https://releases.llvm.org/12.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-identifier-naming.html 26 - { key: readability-identifier-naming.NamespaceCase, value: CamelCase } 27 - { key: readability-identifier-naming.ClassCase, value: CamelCase } 28 - { key: readability-identifier-naming.StructCase, value: CamelCase } 29 - { key: readability-identifier-naming.UnionCase, value: CamelCase } 30 - { key: readability-identifier-naming.EnumCase, value: CamelCase } 31 - { key: readability-identifier-naming.TypedefCase, value: CamelCase } 32 - { key: readability-identifier-naming.TypeAliasCase, value: CamelCase } 33 - { key: readability-identifier-naming.FunctionCase, value: CamelCase } 34 - { key: readability-identifier-naming.GlobalVariableCase, value: camelBack } 35 - { key: readability-identifier-naming.GlobalVariablePrefix, value: g_ } 36 - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE } 37 - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } 38 - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } 39 - { key: readability-identifier-naming.ClassConstantCase, value: UPPER_CASE } 40 - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } 41 - { key: readability-identifier-naming.LocalConstantCase, value: camelBack } 42 - { key: readability-identifier-naming.ParameterCase, value: camelBack } 43 # 如下例外无法处理:对于struct/union的成员变量,仍采用小驼峰不加后缀的命名方式,与局部变量命名风格一致 44 # - { key: readability-identifier-naming.ClassMemberCase, value: camelCase } 45 # - { key: readability-identifier-naming.PublicMemberSuffix, value: _ } 46 # - { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ } 47 # - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } 48 49 # 规则8.1.1 避免函数过长,函数不超过50行(非空非注释) 50 - { key: readability-function-size.LineThreshold, value: 50 } 51 # 建议8.3.3 函数的参数个数不超过5个 52 - { key: readability-function-size.ParameterThreshold, value: 5 } 53 - { key: readability-function-size.NestingThreshold, value: 4 } 54 - { key: bugprone-assert-side-effect.CheckFunctionCalls, value: 1 } 55 - { key: modernize-use-transparent-functors.SafeMode, value: 1 } 56 57