Skip to content

Commit

Permalink
Fix empty impacts for hotspots
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Nov 4, 2024
1 parent db7ae38 commit fbe6a10
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/org/sonarlint/intellij/finding/LiveFinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,15 @@ protected LiveFinding(Module module, RaisedFindingDto finding, VirtualFile virtu
this.severity = null;
this.cleanCodeAttribute = CleanCodeAttribute.fromDto(finding.getSeverityMode().getRight().getCleanCodeAttribute());
this.impacts = finding.getSeverityMode().getRight().getImpacts();
var highestQualityImpact = Collections.max(impacts, Comparator.comparing(ImpactDto::getImpactSeverity));
this.highestQuality = SoftwareQuality.fromDto(highestQualityImpact.getSoftwareQuality());
this.highestImpact = ImpactSeverity.fromDto(highestQualityImpact.getImpactSeverity());
// Is empty for Security Hotspots
if (!impacts.isEmpty()) {
var highestQualityImpact = Collections.max(impacts, Comparator.comparing(ImpactDto::getImpactSeverity));
this.highestQuality = SoftwareQuality.fromDto(highestQualityImpact.getSoftwareQuality());
this.highestImpact = ImpactSeverity.fromDto(highestQualityImpact.getImpactSeverity());
} else {
this.highestQuality = null;
this.highestImpact = null;
}
}
}

Expand Down

0 comments on commit fbe6a10

Please sign in to comment.