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