# ── ViewDesignEngine clang-tidy 配置 ──────────────────────────────
# C++17 CAD 几何引擎静态分析规则集
#
# 校验要求:
#   Checks:          clang-tidy-14 / clang-tidy-18
#   FormatStyle:     file (.clang-format 优先)
#   HeaderFilterRegex: 只分析项目头文件，不检查 Eigen/GTest 等第三方头文件
#   WarningsAsErrors: 'bugprone-*,cert-*,misc-use-after-move,performance-*'

Checks: >
  -*,
  bugprone-*,
  -bugprone-easily-swappable-parameters,
  -bugprone-narrowing-conversions,
  cert-*,
  -cert-err58-cpp,
  clang-analyzer-*,
  cppcoreguidelines-*,
  -cppcoreguidelines-avoid-magic-numbers,
  -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
  -cppcoreguidelines-pro-type-vararg,
  -cppcoreguidelines-pro-type-reinterpret-cast,
  -cppcoreguidelines-owning-memory,
  google-*,
  -google-readability-todo,
  -google-runtime-references,
  misc-*,
  -misc-include-cleaner,
  -misc-non-private-member-variables-in-classes,
  -misc-no-recursion,
  modernize-*,
  -modernize-use-trailing-return-type,
  -modernize-use-nodiscard,
  performance-*,
  portability-*,
  readability-*,
  -readability-magic-numbers,
  -readability-identifier-length,
  -readability-function-cognitive-complexity,
  -readability-isolate-declaration,

WarningsAsErrors: >
  bugprone-*,
  -bugprone-easily-swappable-parameters,
  -bugprone-narrowing-conversions,
  cert-*,
  clang-analyzer-*,
  performance-*,

HeaderFilterRegex: 'include/vde/.*\.h$'

FormatStyle: file

CheckOptions:
  # ── 命名约定 ──
  - key: readability-identifier-naming.ClassCase
    value: CamelCase
  - key: readability-identifier-naming.StructCase
    value: CamelCase
  - key: readability-identifier-naming.FunctionCase
    value: camelBack
  - key: readability-identifier-naming.VariableCase
    value: camelBack
  - key: readability-identifier-naming.MemberCase
    value: camelBack
  - key: readability-identifier-naming.MemberSuffix
    value: '_'
  - key: readability-identifier-naming.EnumCase
    value: CamelCase
  - key: readability-identifier-naming.EnumConstantCase
    value: CamelCase
  - key: readability-identifier-naming.NamespaceCase
    value: lower_case
  - key: readability-identifier-naming.TemplateParameterCase
    value: CamelCase
  - key: readability-identifier-naming.TypeAliasCase
    value: CamelCase
  - key: readability-identifier-naming.GlobalConstantCase
    value: UPPER_CASE
  - key: readability-identifier-naming.StaticConstantCase
    value: UPPER_CASE
  - key: readability-identifier-naming.ConstexprVariableCase
    value: UPPER_CASE
  - key: readability-identifier-naming.MacroDefinitionCase
    value: UPPER_CASE

  # ── 现代 C++ 检查 ──
  - key: modernize-use-auto.MinTypeNameLength
    value: '8'
  - key: modernize-use-auto.RemoveStars
    value: 'true'
  - key: modernize-use-emplace.ContainersWithPushBack
    value: 'std::vector;std::list;std::deque'
  - key: modernize-loop-convert.UseCxx20ReverseRanges
    value: 'true'
  - key: modernize-pass-by-value.ValuesOnly
    value: 'true'

  # ── 性能检查 ──
  - key: performance-move-const-arg.CheckTriviallyCopyableMove
    value: 'true'
  - key: performance-for-range-copy.WarnOnAllAutoCopies
    value: 'true'
  - key: performance-unnecessary-value-param.AllowedTypes
    value: ''

  # ── 代码准则 ──
  - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
    value: 'true'
  - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
    value: 'true'

  # ── 杂项 ──
  - key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries
    value: 'true'

  # ── bug 检测 ──
  - key: bugprone-argument-comment.StrictMode
    value: 'false'
  - key: bugprone-exception-escape.FunctionsThatShouldNotThrow
    value: ''

  # ── 可读性 ──
  - key: readability-function-size.LineThreshold
    value: '-1'
  - key: readability-function-size.StatementThreshold
    value: '800'
  - key: readability-function-size.BranchThreshold
    value: '-1'
  - key: readability-function-size.ParameterThreshold
    value: '-1'
  - key: readability-simplify-subscript-expr.Types
    value: '::std::vector;::std::array'
