# ---------------------------------------------------------------------------
# Enabled check categories
# All checks in each group are enabled, then individual noisy or irrelevant
# ones are disabled with a leading dash.
#
# Disabled:
#   -bugprone-easily-swappable-parameters   -- C functions often share a type by design
#   -bugprone-reserved-identifier           -- fires on common POSIX/system headers
#   -cert-dcl37-c / -cert-dcl51-cpp        -- same POSIX reserved-identifier false positives
#   -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
#                                           -- fires on every memcpy/memset in low-level code
#   -misc-include-cleaner                   -- false positives with umbrella headers
# ---------------------------------------------------------------------------
Checks: "clang-analyzer-*,bugprone-*,cert-*,misc-*,performance-*,portability-*,readability-*,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-cert-dcl37-c,-cert-dcl51-cpp,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,-misc-include-cleaner"

# Any active check that fires is treated as a build error.
WarningsAsErrors: "*"

# Only surface diagnostics that originate from project headers, not from
# system or third-party headers.
HeaderFilterRegex: "(src|bindings)/.*\\.h$"

# ---------------------------------------------------------------------------
# Per-check option overrides
# ---------------------------------------------------------------------------
CheckOptions:
  # cert-err33-c: only flag unchecked returns from the three core allocators.
  - key: cert-err33-c.CheckedFunctions
    value: "malloc;calloc;realloc"

  # readability-function-size: keep functions small and focused.
  - key: readability-function-size.LineThreshold
    value: "60"
  - key: readability-function-size.StatementThreshold
    value: "40"
  - key: readability-function-size.BranchThreshold
    value: "10"
  - key: readability-function-size.ParameterThreshold
    value: "5"
  - key: readability-function-size.NestingThreshold
    value: "4"

  # readability-function-cognitive-complexity: bound overall complexity.
  - key: readability-function-cognitive-complexity.Threshold
    value: "15"
