ich Sonar Verletzung bin immer:Sonar Fehlerbedingungen sollte nicht unbedingt auf „TRUE“ oder „FALSE“ bewerten
„Bedingungen sollten nicht unbedingt bewerten auf‚TRUE‘oder‚FALSE‘“
für den folgenden Code.
List<MediaContent> savedList = source.getChildMediaContents();
List<MediaContent> supplierList = target.getChildMediaContents();
// if existing and incoming both empty
if(savedList == null && supplierList == null){
return false;
}
// if one is null and other is not then update is required
if(savedList == null && supplierList != null){
return true;
}
if(savedList != null && supplierList == null){
return true;
}
Unterhalb der beiden Blöcke, wenn es
// if one is null and other is not then update is required
if(savedList == null && supplierList != null){
return true;
}
if(savedList != null && supplierList == null){
return true;
}
Sie könnten sogar die letzten zwei if-Klauseln mit 'if (savedList == null || supplierList == null) return true' –
Danke @ChristianLutz, gute Idee, aktualisiert – janos