HS-Flensburg-PLTP / jlint

Other
0 stars 0 forks source link

Simplify #401

Closed jan-christiansen closed 6 months ago

jan-christiansen commented 11 months ago

Es sollte eine Regel geben, die auftretende Muster für Vereinfachungen identifiziert. In der folgenden Implementierung sollte zum Beispiel equals statt compareTo verwendet werden.

public boolean isStartDate(LocalDate date) {
    if (this.startDate.compareTo(date) == 0) {
        return true;
     } else {
        return false;
    }
}
jan-christiansen commented 6 months ago

The rule Simplify implements this pattern. Currently the code is commented out because the approach is too simple and caused problems in contexts where the use of compareTo and 0 is reasonable.