Checks: '
         *,
         -*-default-arguments*,
         -*braces-around-statements,
         -google-build-using-namespace,
         -clang-analyzer-security.insecureAPI.rand,
         -cppcoreguidelines-pro-type-reinterpret-cast,
         -modernize-pass-by-value,
         -cppcoreguidelines-pro-bounds-constant-array-index,
         -cppcoreguidelines-pro-type-static-cast-downcast,
         -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
         -hicpp-no-array-decay,
         -cert-dcl58-cpp,
         -modernize-avoid-bind,
         -cert-env33-c,
         -misc-macro-parentheses,
         -fuchsia-overloaded-operator,
         -cppcoreguidelines-pro-bounds-pointer-arithmetic,
         -google-runtime-references,
         -cert-err58-cpp,
         -llvm-include-order,
         -clang-analyzer-cplusplus.NewDelete*,
         -cert-msc32-c,
         -cert-msc51-cpp,
         -fuchsia-statically-constructed-objects,
         -bugprone-exception-escape,
         -*-uppercase-literal-suffix,
         -cert-dcl16-c,
         -*-magic-numbers,
         -*-non-private-member-variables-in-classes,
         -modernize-use-trailing-return-type,
         -clang-diagnostic-unknown-warning-option,
         -modernize-use-nodiscard,
         -llvmlibc-*,
         -altera-*,
         -abseil-*,
         -readability-avoid-const-params-in-decls,
         -readability-function-cognitive-complexity,
         -readability-use-anyofallof,
         -misc-no-recursion,
         -bugprone-easily-swappable-parameters,
         -bugprone-suspicious-include,
         -bugprone-unchecked-optional-access
         '

WarningsAsErrors: '*'

# Explanation of disabled checks:
#   - *-default-arguments*                                      We do use default arguments (and like them).
#   - google-build-using-namespace                              We use `using namespace` a lot (see anonymous namespaces and expression_functional).
#   - clang-analyzer-security.insecureAPI.rand                  We don't care about cryptographically unsafe rand() calls.
#   - cppcoreguidelines-pro-type-reinterpret-cast               We use reinterpret_cast
#   - modernize-pass-by-value                                   We don't trust people to properly use std::move
#   - cppcoreguidelines-pro-bounds-constant-array-index         "Do not use array subscript when the index is not an integer constant expression"?!
#   - cppcoreguidelines-pro-type-static-cast-downcast           We use static downcasts when we can safely obtain the type (e.g., static casts of LQPNodes via node->type)
#   - cppcoreguidelines-pro-bounds-array-to-pointer-decay       Weird stuff - it doesn't like `description_mode == DescriptionMode::MultiLine`
#   - hicpp-no-array-decay                                       (same)
#   - cert-dcl58-cpp                                            Adding a hash function to std is perfectly legal: https://en.cppreference.com/w/cpp/language/extending_std
#   - modernize-avoid-bind                                      meh, bind isn't thaaaat bad
#   - cert-env33-c                                              Yes, we do call system()
#   - misc-macro-parentheses                                    Causes weird problems with BOOST_PP_TUPLE_ELEM
#   - fuchsia-overloaded-operator                               We are not supposed to overload operator()?!
#   - cppcoreguidelines-pro-bounds-pointer-arithmetic           Doesn't like DebugAssert
#   - google-runtime-references                                 Doesn't like mutable references
#   - cert-err58-cpp                                            We reeeeeally don't care about uncaught exceptions
#   - llvm-include-order                                        Handled by cpplint.py which is way faster
#   - clang-analyzer-cplusplus.NewDelete*                       False positives with shared_ptr::operator=
#   - cert-msc32-c, -cert-msc51-cpp                             Ok, so our generated tables are not cryptographically safe
#   - fuchsia-statically-constructed-objects                    We have too many static objects
#   - bugprone-exception-escape                                 We throw exceptions in many places (even destructors) and are completely fine with std::terminate
#   - *-uppercase-literal-suffix                                We do not really care if it is 1.0f or 1.0F.
#   - cert-dcl16-c                                               (same)
#   - *-magic-numbers                                           Too many false positives
#   - *-non-private-member-variables-in-classes                 We like making things public
#   - modernize-use-trailing-return-type                        https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-trailing-return-type.html - no that is way too weird
#   - clang-diagnostic-unknown-warning-option                   Don't complain about gcc warning options
#   - modernize-use-nodiscard                                   Don't want to tag everything [[nodiscard]]
#   - llvmlibc-*                                                LLVM-internal development guidelines.
#   - altera-*                                                  Checks related to OpenCL programming for FPGAs.
#   - abseil-*                                                  Checks related to Google's abseil library (not used in Hyrise).
#   - readability-avoid-const-params-in-decls                   Even though they might not have an effect, we prefer declarations to mirror implementations.
#   - readability-function-cognitive-complexity                 When appropriate, long functions with a sequential data flow (which is sometimes easier to read) are fine. In many
#                                                                places, the rule catches functions where the code could be improved, but will likely not be due to a lack of time.
#   - readability-use-anyofallof                                We prefer `for (auto item : items)` over `std::ranges::all_of()` with a lambda.
#   - misc-no-recursion                                         Ignore general recommendation to avoid recursion, which we commonly use when working with query plans.
#   - bugprone-easily-swappable-parameters                      Ignore issues with swappable parameters as we found them to be of no help.
#   - bugprone-suspicious-include                               Unity builds use `#include`s for cpp files. However, unity builds significantly improve the runtime of clang-tidy,
#                                                                which is otherwise the slowest step of the CI pipeline by a factor of two. Furthermore, the linter checks for 
#                                                                these includes as well.
#   - bugprone-unchecked-optional-access                        Too many false positives (with clang-tidy 14/15). TODO(anyone): Re-evaluate for future clang versions.


CheckOptions:
  - { key: readability-identifier-naming.ClassCase, value: CamelCase }
  - { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE }
  - { key: readability-identifier-naming.EnumCase, value: CamelCase }
  - { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
  - { key: readability-identifier-naming.FunctionCase, value: lower_case }
  - { key: readability-identifier-naming.GlobalFunctionCase, value: lower_case }
  - { key: readability-identifier-naming.InlineNamespaceCase, value: lower_case }
  - { key: readability-identifier-naming.LocalConstantCase, value: lower_case }
  - { key: readability-identifier-naming.LocalVariableCase, value: lower_case }
  - { key: readability-identifier-naming.MemberCase, value: lower_case }
  - { key: readability-identifier-naming.PrivateMemberPrefix, value: '_' }
  - { key: readability-identifier-naming.ProtectedMemberPrefix, value: '_' }
  - { key: readability-identifier-naming.PublicMemberCase, value: lower_case }
  - { key: readability-identifier-naming.MethodCase, value: lower_case }
  - { key: readability-identifier-naming.PrivateMethodPrefix, value: '_' }
  - { key: readability-identifier-naming.ProtectedMethodPrefix, value: '_' }
  - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
  - { key: readability-identifier-naming.ParameterCase, value: lower_case }
  - { key: readability-identifier-naming.ConstantParameterCase, value: lower_case }
  - { key: readability-identifier-naming.ParameterPackCase, value: lower_case }
  - { key: readability-identifier-naming.StaticConstantCase, value: lower_case }
  - { key: readability-identifier-naming.StaticVariableCase, value: lower_case }
  - { key: readability-identifier-naming.StructCase, value: CamelCase }
  - { key: readability-identifier-naming.TemplateParameterCase, value: UPPER_CASE }
  - { key: readability-identifier-naming.TemplateTemplateParameterCase, value: CamelCase }
  - { key: readability-identifier-naming.TemplateUsingCase, value: lower_case }
  - { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
  - { key: readability-identifier-naming.TypedefCase, value: CamelCase }
  - { key: readability-identifier-naming.UnionCase, value: CamelCase }
  - { key: readability-identifier-naming.UsingCase, value: lower_case }
  - { key: readability-identifier-naming.ValueTemplateParameterCase, value: lower_case }
  - { key: readability-identifier-naming.VariableCase, value: lower_case }

  # Iff(!) the context is clear, very short parameter/variable names are acceptable. Current exceptions are 'it' for
  # iterator, 'op' for operator, 'od' for order dependency, or 'fd' for functional dependency.
  - { key: readability-identifier-length.IgnoredParameterNames, value: '^(it|op|od|fd)$' }
  - { key: readability-identifier-length.IgnoredVariableNames, value: '^(it|op|od|fd)$' }

  # Boost, nlohmann::json, and SQLParser use umbrella headers which clang-tidy's include cleaner does not (yet) handle
  # well. For now, we ignore all include cleaner issues for these three libraries.
  - { key: misc-include-cleaner.IgnoreHeaders, value: 'boost/.*;sql/.*\.h;nlohmann/.*' }

  # We allow checking `if (var)` without a bool conversion in case var is of type pointer or std::optional.
  - { key: readability-implicit-bool-conversion.AllowPointerConditions, value: true }
