# clang-tidy for peachycheck: every bugprone, cppcoreguidelines and performance check is on,
# except where the check is wrong for any code, not just for today's:
# - unchecked container access, constant array index: the only fix, .at(), puts a bounds
#   check into hot loops. Debug builds check those bounds instead: TYR_STDLIB_ASSERTIONS
#   (CMakeLists.txt) defines _GLIBCXX_ASSERTIONS, so operator[] of std::vector, std::array and
#   std::span asserts its index there, at no cost in Release;
# - easily-swappable-parameters: a heuristic without a clear fix;
# - avoid-c-arrays: std::unique_ptr<T[]> with make_unique_for_overwrite is the uninitialized buffer,
#   which std::vector would zero;
# - crtp-constructor-accessibility: private mixin constructors break inheriting constructors
#   (using Base::Base) and aggregate initialization of derived types.
# From the other families, the checks that find defects rather than enforce a style: the static
# analyzer (clang-analyzer-*), concurrency, include cycles, redundant expressions, external linkage
# of file-local functions, discarded results, nested namespace syntax, C-style casts, declarations
# whose parameter names differ from the definition, non-inline definitions in headers (ODR), ignored
# C return values, dead code (unused declarations and parameters, redundant declarations and casts,
# member functions that could be const) and the modern forms that rule out a defect class (override,
# nullptr, make_unique, deleted and defaulted members, misleading identifiers and indentation). Not
# misc-const-correctness: in templates it reports variables as never modified that an overload
# chosen at instantiation does modify (hash_combine's seed, fold-expression counters); following it
# made hash_combine recurse forever.
# Not google-explicit-constructor: the standard library's own idioms need implicit conversions
# that it forbids, with no option to allow them: proxy references convert to their value (as
# std::vector<bool>::reference does, and iterator concepts require it), and views of mutable
# elements convert to views of const ones (as std::span does).
# Not portability-template-virtual-member-function: it warns that other compilers (MSVC)
# instantiate unused virtual members of class templates; the libraries build only with GCC and
# Clang (Linux and macOS), which instantiate only what is used, so no build can check a fix.
# tests/ turns off more in their own files, each with its reason.
Checks: >
  -*,
  bugprone-*,
  cppcoreguidelines-*,
  performance-*,
  clang-analyzer-*,
  concurrency-*,
  misc-header-include-cycle,
  misc-redundant-expression,
  misc-use-internal-linkage,
  modernize-use-nodiscard,
  modernize-concat-nested-namespaces,
  modernize-avoid-c-style-cast,
  google-runtime-int,
  readability-inconsistent-declaration-parameter-name,
  misc-definitions-in-headers,
  cert-err33-c,
  misc-unused-using-decls,
  misc-unused-alias-decls,
  misc-unused-parameters,
  readability-redundant-declaration,
  readability-redundant-casting,
  readability-redundant-string-cstr,
  readability-make-member-function-const,
  modernize-use-emplace,
  modernize-use-equals-default,
  modernize-use-equals-delete,
  modernize-use-override,
  modernize-use-nullptr,
  modernize-use-using,
  modernize-make-unique,
  modernize-make-shared,
  misc-misplaced-const,
  misc-throw-by-value-catch-by-reference,
  misc-unconventional-assign-operator,
  misc-non-copyable-objects,
  misc-confusable-identifiers,
  misc-misleading-bidirectional,
  misc-misleading-identifier,
  readability-misleading-indentation,
  readability-duplicate-include,
  readability-non-const-parameter,
  hicpp-multiway-paths-covered,
  -cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,
  -cppcoreguidelines-pro-bounds-constant-array-index,
  -bugprone-easily-swappable-parameters,
  -cppcoreguidelines-avoid-c-arrays,
  -bugprone-crtp-constructor-accessibility
HeaderFilterRegex: '.*/(include/tyr|tests|profiling|python/src|exe)/.*'
ExcludeHeaderFilterRegex: '.*/(dependencies-install|dependencies-build|build|site-packages|_deps)/.*'
CheckOptions:
  # Views are handles (an index or data handle plus a context pointer), passed by value like
  # std::string_view; only cista's variant inside some of them makes their copy non-trivial.
  # Matched by name as written, so the aliases (TermView, FunctionExpressionView<T>) match too.
  performance-unnecessary-value-param.AllowedTypes: 'View<;View$'
  # Member initializers are written `= value`, as elsewhere in the code.
  cppcoreguidelines-use-default-member-init.UseAssignment: true
  # YGG_ASSUME (yggdrasil/core/config.hpp) must expand at its call site, like assert: the
  # analysis of optionals sees a condition only in the function that states it, never through a call.
  cppcoreguidelines-macro-usage.AllowedRegexp: '^YGG_ASSUME$'
