// cppcheck suppressions
assertWithSideEffect

// TODO: need to come back to these
duplInheritedMember

// TODO:
// "Using memset() on struct which contains a floating point number."
// tried:
//   if (std::is_floating_point<T>::value) {
//     p = 0;
// in src/mesh/MemoryPool.h
memsetClassFloat

knownConditionTrueFalse

// no real downside/harm in these
unusedFunction
unusedPrivateFunction

// most likely due to a cppcheck configuration issue (like missing an include)
syntaxError

// try to quiet a few
//useInitializationList:src/main.cpp
useInitializationList

//unreadVariable:src/graphics/Screen.cpp
unreadVariable

// I don't want to go back and cast function pointers just to appease a tools insatiable thirst for immutability
constParameterCallback

redundantInitialization

//cstyleCast:src/mesh/MemoryPool.h:71
cstyleCast

// ignore stuff that is not ours
*:.pio/*
*:*/libdeps/*
*:*/generated/*
// emscripten-only wasm node: EM_ASYNC_JS/EM_JS expand to constructs cppcheck
// can't parse (internalAstError), and these sources are not part of any checked
// board build ([env:native-wasm] is board_level=extra, compiled by the build-wasm
// CI job, not pio check). Don't analyze them here.
*:*/platform/portduino/wasm/*
noExplicitConstructor:*/mqtt/*
postfixOperator:*/mqtt/*

// these two caused issues
missingOverride
virtualCallInConstructor

internalAstError:*/CrossPlatformCryptoEngine.cpp
uninitMemberVar:*/AudioThread.h

// False positive: make_zeroizing_array() returns unique_ptr<uint8_t[], ...>, so
// .get() is uint8_t*, not void*. cppcheck can't resolve the custom-deleter alias
// and reports arithmetic on these buffers as void* pointer math.
arithOperationsOnVoidPointer:*/EncryptedStorage.cpp

useStlAlgorithm

variableScope

// cppcheck 2.20 (ESP32 only)
//
// The ESP32 CI images build on the pioarduino core, whose esp32 platform installs its own
// tool-cppcheck 2.20.1 and reinstalls it over any pinned version. Every other platform still
// resolves platformio/tool-cppcheck 1.21100.230717, i.e. cppcheck 2.11. 2.20 parses far more of
// this tree than 2.11 managed to, so checks that have always been enabled started firing for the
// first time - 388 defects on ESP32, none anywhere else, for identical source.
//
// Silence the checks that appeared with that jump so the gate means the same thing on every
// platform again. These are style and performance suggestions, not defects; burning them down is
// worth doing deliberately, not under a CI outage.
functionStatic
staticFunction
constParameterPointer
iterateByValue
returnByReference
passedByValue
uselessOverride

constVariable
constVariablePointer
constVariableReference
constParameterReference

// Single deliberate sites, scoped so a new one elsewhere still fails the gate. Router folds the
// bitfield's want_response bit into the decoded bool; Power interpolates the OCV curve in float.
bitwiseOnBoolean:*/Router.cpp
suspiciousFloatingPointCast:*/Power.cpp

// The 2.20 successor to cstyleCast, which is already suppressed above for the same reason.
dangerousTypeCast

// Sensor drivers hold a driver object they new in begin() and are constructed once, at global
// scope. cppcheck wants the rule of three on them; nothing ever copies one.
noCopyConstructor:*/Telemetry/Sensor/*
noOperatorEq:*/Telemetry/Sensor/*
