UseColor: true
Checks:
  - -*
  - bugprone-*
  # Too many warnings
  - -bugprone-assignment-in-if-condition
  # Too many warnings
  - -bugprone-narrowing-conversions
  # Kind of nonsense
  - -bugprone-easily-swappable-parameters
  # Too many warnings for now
  - -bugprone-implicit-widening-of-multiplication-result
  # Exception handling patterns in Nix
  - -bugprone-empty-catch
  # Many warnings
  - -bugprone-unchecked-optional-access
  # Many warnings, questionable lint
  - -bugprone-branch-clone
  # Extremely noisy before clang 19: https://github.com/llvm/llvm-project/issues/93959
  - -bugprone-multi-level-implicit-pointer-conversion
  # We don't compile out our asserts
  - -bugprone-assert-side-effect
  # TODO: figure out if this warning is useful
  - -bugprone-exception-escape
  # We use pointers to aggregates intentionally; void * would look weird
  - -bugprone-sizeof-expression
  #
  # Checks disabled to pass on current codebase (can be progressively enabled):
  #
  # 11 warnings - optional value conversions in various places
  - -bugprone-optional-value-conversion
  # 4 warnings - switches without default cases
  - -bugprone-switch-missing-default-case
  # 4 warnings - string_view::data() usage patterns
  - -bugprone-suspicious-stringview-data-usage
  # 4 warnings - .cc files included in other files (intentional pattern)
  - -bugprone-suspicious-include
  # 2 warnings - unused return values (AllowCastToVoid helps but some remain)
  - -bugprone-unused-return-value
  # 2 warnings - unused local RAII-style variables
  - -bugprone-unused-local-non-trivial-variable
  # 2 warnings - returning const& from parameter
  - -bugprone-return-const-ref-from-parameter
  # 1 warning - signed char misuse
  - -bugprone-signed-char-misuse
  # 1 warning - calling parent virtual instead of override
  - -bugprone-parent-virtual-call
  # 1 warning - null termination issues
  - -bugprone-not-null-terminated-result
  # 1 warning - macro parentheses
  - -bugprone-macro-parentheses
  # 1 warning - increment/decrement in conditions
  - -bugprone-inc-dec-in-conditions
  # 2 warnings - sorts Value* by ->string_view(), not by pointer value (false positive)
  - -bugprone-nondeterministic-pointer-iteration-order
  # 9 warnings - intentional std::bit_cast/memcpy on Value* arrays (evaluator hot path)
  - -bugprone-bitwise-pointer-cast
  # 1 warning (header) - value.hh mkFailed: GC alloc in noexcept. Boehm's
  # gc_cleanup::operator new isn't marked noexcept but aborts on OOM rather
  # than throws; std::terminate here is the intended behavior anyway.
  - -bugprone-unhandled-exception-at-new
  # 1 warning (header) - fmt.hh Magenta<T>::operator<<: generic colorizer
  # template; fires when T=unsigned char but that instantiation is correct.
  - -bugprone-unintended-char-ostream-output
  #
  # Non-bugprone checks (some disabled to pass on current codebase):
  #
  # 4 warnings - exceptions not derived from std::exception
  # All thrown exceptions must derive from std::exception
  # - hicpp-exception-baseclass
  # 88 warnings - C-style casts should be explicit about intent
  # - cppcoreguidelines-pro-type-cstyle-cast
  # 11 warnings - coroutine lambdas with captures (intentional pattern in async goal/store code)
  # - cppcoreguidelines-avoid-capturing-lambda-coroutines
  - performance-noexcept-swap
  - performance-noexcept-move-constructor
  - performance-noexcept-destructor
  - performance-use-std-move
  - misc-throw-by-value-catch-by-reference
  - cppcoreguidelines-missing-std-forward
  - android-cloexec-open
  - android-cloexec-pipe2
  # Custom nix checks
  - nix-*

CheckOptions:
  # __asan_default_options: ASAN runtime configuration function (see nix-meson-build-support/common/asan-options/)
  # __wrap___assert_fail: Linker-wrapped assert handler for better stack traces (see nix-meson-build-support/common/assert-fail/)
  # _SingleDerivedPathRaw, _DerivedPathRaw: Internal type aliases in derived-path.hh (leading underscore pattern)
  # _SingleBuiltPathRaw, _BuiltPathRaw: Internal type aliases in built-path.hh (leading underscore pattern)
  bugprone-reserved-identifier.AllowedIdentifiers: '__asan_default_options;__wrap___assert_fail;_SingleDerivedPathRaw;_DerivedPathRaw;_SingleBuiltPathRaw;_BuiltPathRaw'
  # Allow explicitly discarding return values with (void) cast
  bugprone-unused-return-value.AllowCastToVoid: true
  bugprone-unsafe-functions.ReportDefaultFunctions: false
  # Repurpose bugprone-unsafe-functions to lint functions that we'd want to wrap.
  bugprone-unsafe-functions.CustomFunctions: >
    ::std::filesystem::create_directories, nix::createDirs, "Use nix::createDirs (it wraps exceptions)";
    ::std::filesystem::remove_all, nix::deletePath, "Use nix::deletePath (remove_all is not TOCTOU safe)";

ExtraArgs: ["-Werror=unnecessary-virtual-specifier"]
