# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# SPDX-License-Identifier: curl
---
# https://clang.llvm.org/extra/clang-tidy/

# https://clang.llvm.org/extra/clang-tidy/checks/list.html
Checks:
  - clang-analyzer-*
  - -clang-analyzer-optin.performance.Padding
  - -clang-analyzer-security.ArrayBound  # due to false positives with clang-tidy 21.1.0+
  - -clang-analyzer-security.insecureAPI.bzero  # for FD_ZERO() (seen on macOS)
  - -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
  - -clang-diagnostic-nullability-extension
  - bugprone-assert-side-effect
  - bugprone-assignment-in-if-condition
  - bugprone-assignment-in-selection-statement
  - bugprone-chained-comparison
  - bugprone-dynamic-static-initializers
  - bugprone-invalid-enum-default-initialization
  - bugprone-macro-parentheses
  - bugprone-macro-repeated-side-effects
  - bugprone-misplaced-operator-in-strlen-in-alloc
  - bugprone-misplaced-pointer-arithmetic-in-alloc
  - bugprone-not-null-terminated-result
  - bugprone-posix-return
  - bugprone-redundant-branch-condition
  - bugprone-signed-char-misuse
  - bugprone-sizeof-expression
  - bugprone-suspicious-enum-usage
  - bugprone-suspicious-memset-usage
  - bugprone-suspicious-missing-comma
  - bugprone-suspicious-realloc-usage
  - bugprone-suspicious-semicolon
  # bugprone-unchecked-string-to-number-conversion  # needs converting sscanf to strtol or curlx_str_*
  - misc-const-correctness
  - misc-header-include-cycle
  # misc-redundant-expression  # undesired hits due to system macros, e.g. due to POLLIN == POLLRDNORM | POLLRDBAND, then or-ing all three
  - portability-*
  - readability-duplicate-include
  # readability-else-after-return
  # readability-enum-initial-value
  # readability-function-cognitive-complexity
  - readability-inconsistent-declaration-parameter-name
  # readability-misleading-indentation  # too many false positives in oddball/conditional source
  - readability-named-parameter
  # readability-redundant-casting  # false positives in types that change from platform to platform, even with IgnoreTypeAliases: true
  - readability-redundant-control-flow
  - readability-redundant-declaration
  - readability-redundant-function-ptr-dereference
  # readability-redundant-nested-if  # would need local suppression in a handful of cases
  # - readability-redundant-parentheses
  - readability-redundant-preprocessor
  - readability-suspicious-call-argument
  - readability-uppercase-literal-suffix

CheckOptions:
  misc-header-include-cycle.IgnoredFilesList: 'curl/curl.h'
  readability-inconsistent-declaration-parameter-name.Strict: true

HeaderFilterRegex: '.*'  # Default in 22.1.0+
