--- Checks: '-*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, modernize-redundant-void-arg, modernize-use-bool-literals, modernize-use-equals-default, modernize-use-nullptr, modernize-use-override, google-explicit-constructor, google-readability-casting, readability-braces-around-statements, readability-identifier-naming.ClassCase, readability-identifier-naming.StructCase, readability-identifier-naming.TypedefCase, readability-identifier-naming.EnumCase, readability-non-const-parameter, cert-dcl21-cpp, bugprone-undelegated-constructor, bugprone-macro-parentheses, bugprone-macro-repeated-side-effects, bugprone-forward-declaration-namespace, bugprone-bool-pointer-implicit-conversion, bugprone-misplaced-widening-cast, cppcoreguidelines-narrowing-conversions, misc-unconventional-assign-operator, misc-unused-parameters' WarningsAsErrors: '' HeaderFilterRegex: '' CheckOptions: # 现代化(Modernize) - key: modernize-redundant-void-arg value: 'true' # 检查并移除函数声明中冗余的 void 参数。 - key: modernize-use-bool-literals value: 'true' # 建议使用布尔字面量 true 和 false 代替整数值 0 和 1。 - key: modernize-use-equals-default value: 'true' # 建议在默认构造函数、复制构造函数和赋值运算符中使用 = default,以简化代码。 - key: modernize-use-nullptr value: 'true' # 建议使用 nullptr 代替 NULL 或 0 来表示空指针。 - key: modernize-use-override value: 'true' # 建议在覆盖基类虚函数时使用 override 关键字,以增加代码的清晰性和安全性。 # Google 代码风格(Google) - key: google-explicit-constructor value: 'true' # 检查并建议在单参数构造函数中使用 explicit 关键字,以防止隐式转换。 - key: google-readability-casting value: 'false' # 检查并建议使用 C++ 风格的类型转换(如 static_cast、dynamic_cast、const_cast 和 reinterpret_cast)代替 C 风格的类型转换。 # 可读性(Readability) - key: readability-braces-around-statements value: 'true' # 建议在单行语句周围添加大括号,以提高代码的可读性和一致性。 - key: readability-identifier-naming.ClassCase value: 'CamelCase' # 类名应使用 CamelCase 风格,例如 MyClassName。 - key: readability-identifier-naming.StructCase value: 'CamelCase' # 结构体名应使用 CamelCase 风格,例如 MyStructName。 - key: readability-identifier-naming.TypedefCase value: 'CamelCase' # 类型定义应使用 CamelCase 风格,例如 MyTypeDef。 - key: readability-identifier-naming.EnumCase value: 'CamelCase' # 枚举名应使用 CamelCase 风格,例如 MyEnumName。 - key: readability-non-const-parameter value: 'true' # 检查并标识非 const 参数,以提高代码的可读性和安全性。 # CERT 安全编码标准(CERT) - key: cert-dcl21-cpp value: 'true' # 检查并标识在头文件中不应包含无命名空间的 using 声明和指令,以防止命名空间污染。 # Bug 检测(Bugprone) - key: bugprone-undelegated-constructor value: 'true' # 检查并标识未委托的构造函数,以确保构造函数的正确性。 - key: bugprone-macro-parentheses value: 'true' # 检查并建议在宏定义中使用括号,以防止潜在的错误。 - key: bugprone-macro-repeated-side-effects value: 'true' # 检查并标识宏中重复的副作用,以防止潜在的错误。 - key: bugprone-forward-declaration-namespace value: 'true' # 检查并标识命名空间前向声明的潜在问题。 - key: bugprone-bool-pointer-implicit-conversion value: 'true' # 检查并标识布尔指针的隐式转换,以防止潜在的错误。 - key: bugprone-misplaced-widening-cast value: 'true' # 检查并标识错误的宽化转换,以防止潜在的错误。 # C++ 核心指南(CppCoreGuidelines) - key: cppcoreguidelines-narrowing-conversions value: 'true' # 检查并标识可能导致数据丢失的窄化转换。 # 杂项(Miscellaneous) - key: misc-unconventional-assign-operator value: 'true' # 检查并标识不常见的赋值操作符重载,以确保代码的一致性和可维护性。 - key: misc-unused-parameters value: 'true' # 检测未使用的参数。 ...