dimanche 28 mars 2021

java:S1121: "Extract the assignment out of this expression."

I've a big java project given by my teacher for the exam, and analysis with sonarcloud gives me this Code Smell to fix on this function

private long selIsBidAction(boolean isBidAction, long takerReserveBidPrice, DirectOrder makerOrder) {
    if(isBidAction) {
        return takerReserveBidPrice;
    } else {
        return makerOrder.reserveBidPrice;
    }
}

In particular it's about "if(isBidAction)". I thought to put isBidAction=true immediately upon that if to fix this.Could it be a solution?

Aucun commentaire:

Enregistrer un commentaire