mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
test: supress any_of suggestions in cppcheck-dash
even it maybe useful lint message for some particular case, sometimes it asks to make an refactoring that will be over-complex. For example, it asks to refactor external loop to std::any_of: ``` for (const auto& inner_entry : vecEntries) { if (ranges::any_of(inner_entry.vecTxDSIn, [&txin](const auto& txdsin){ return txdsin.prevout == txin.prevout; })) { LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- ERROR: already have this txin in entries\n", __func__); nMessageIDRet = ERR_ALREADY_HAVE; // Two peers sent the same input? Can't really say who is the malicious one here, // could be that someone is picking someone else's inputs randomly trying to force // collateral consumption. Do not punish. return false; } } ``` That's possible to refactor, but that's unreasonable complexity to have an lambda inside an lambda... That's unreasonable. Some other suggestion are also non-trivial. One more suppression for any_of in llmq/commitment which is false-alarm: There's used index but linter doesn't see it: ``` for (const auto i : irange::range(members.size(), size_t(llmq_params.size))) { if (validMembers[i]) { LogPrintfFinalCommitment("q[%s] invalid validMembers bitset. bit %d should not be set\n", quorumHash.ToString(), i); return false; } if (signers[i]) { LogPrintfFinalCommitment("q[%s] invalid signers bitset. bit %d should not be set\n", quorumHash.ToString(), i); return false; } } ```
This commit is contained in:
parent
7daa9bea9a
commit
c23c25d00b
@ -30,6 +30,8 @@ IGNORED_WARNINGS=(
|
||||
"src/rpc/masternode.cpp:.*:21: warning: Consider using std::copy algorithm instead of a raw loop." # UniValue doesn't support std::copy
|
||||
"src/cachemultimap.h:.*: warning: Variable 'mapIt' can be declared as reference to const"
|
||||
"src/evo/simplifiedmns.cpp:.*:20: warning: Consider using std::copy algorithm instead of a raw loop."
|
||||
"src/llmq/commitment.cpp.* warning: Consider using std::all_of or std::none_of algorithm instead of a raw loop. \[useStlAlgorithm\]"
|
||||
|
||||
# General catchall, for some reason any value named 'hash' is viewed as never used.
|
||||
"Variable 'hash' is assigned a value that is never used."
|
||||
|
||||
@ -37,7 +39,8 @@ IGNORED_WARNINGS=(
|
||||
# "Consider performing initialization in initialization list."
|
||||
"Consider using std::transform algorithm instead of a raw loop."
|
||||
"Consider using std::accumulate algorithm instead of a raw loop."
|
||||
# "Consider using std::any_of algorithm instead of a raw loop."
|
||||
"Consider using std::any_of algorithm instead of a raw loop."
|
||||
"Consider using std::copy_if algorithm instead of a raw loop."
|
||||
# "Consider using std::count_if algorithm instead of a raw loop."
|
||||
# "Consider using std::find_if algorithm instead of a raw loop."
|
||||
# "Member variable '.*' is not initialized in the constructor."
|
||||
|
Loading…
Reference in New Issue
Block a user