Open vm06007 opened 1 year ago
The referenced else clause will validate that currentDiff < current Biggest in an AND (&&) clause with its main condition redundantly as the inverse of the condition is evaluated in the if clause of the overall statement.
else
currentDiff < current Biggest
&&
if
if (currentDiff >= currentBiggest) { currentSecondBiggest = currentBiggest; currentBiggest = currentDiff; } else if (currentDiff > currentSecondBiggest && currentDiff < currentBiggest) { currentSecondBiggest = currentDiff; }
We advise the currentDiff < currentBiggest condition to be omitted as it is implied by the if clause's failure.
currentDiff < currentBiggest
addressed in: https://github.com/wise-foundation/lending-audit/pull/77
OHR-06C: Redundant Conditional Evaluation
Description:
The referenced
else
clause will validate thatcurrentDiff < current Biggest
in an AND (&&
) clause with its main condition redundantly as the inverse of the condition is evaluated in theif
clause of the overall statement.Example:
Recommendation:
We advise the
currentDiff < currentBiggest
condition to be omitted as it is implied by theif
clause's failure.