diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2024-11-06 14:18:42 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-11-11 20:02:44 +0000 |
commit | 191a2c5e5ea80d3905d0042adafc391bf121e7f0 (patch) | |
tree | a019ec78b0fa880c2c153a8757e149e1d495dded /server/sonar-ce-task-projectanalysis/src | |
parent | d6ecbc0f912a8951ebfaabf8e803239db15eff3c (diff) | |
download | sonarqube-191a2c5e5ea80d3905d0042adafc391bf121e7f0.tar.gz sonarqube-191a2c5e5ea80d3905d0042adafc391bf121e7f0.zip |
SONAR-23474 Project import/export supports manual impact severity
Diffstat (limited to 'server/sonar-ce-task-projectanalysis/src')
3 files changed, 7 insertions, 4 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStepIT.java b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStepIT.java index 3dae30abdb8..fbd952c6cd6 100644 --- a/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStepIT.java +++ b/server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStepIT.java @@ -232,8 +232,8 @@ public class ExportIssuesStepIT { .setRuleDescriptionContextKey("test_rule_description_context_key") .setIssueCreationTime(963L) .setIssueUpdateTime(852L) - .addImpact(new ImpactDto().setSoftwareQuality(SoftwareQuality.MAINTAINABILITY).setSeverity(Severity.HIGH)) - .addImpact(new ImpactDto().setSoftwareQuality(SoftwareQuality.SECURITY).setSeverity(Severity.BLOCKER)) + .addImpact(new ImpactDto().setSoftwareQuality(SoftwareQuality.MAINTAINABILITY).setSeverity(Severity.HIGH).setManualSeverity(true)) + .addImpact(new ImpactDto().setSoftwareQuality(SoftwareQuality.SECURITY).setSeverity(Severity.BLOCKER).setManualSeverity(false)) .setIssueCloseTime(741L) .setCodeVariants(List.of("v1", "v2")); @@ -270,8 +270,9 @@ public class ExportIssuesStepIT { assertThat(issue.getIssueUpdatedAt()).isEqualTo(issueDto.getIssueUpdateTime()); assertThat(issue.getIssueClosedAt()).isEqualTo(issueDto.getIssueCloseTime()); assertThat(issue.getLocations()).isNotEmpty(); - assertThat(issue.getImpactsList()).extracting(ProjectDump.Impact::getSoftwareQuality, ProjectDump.Impact::getSeverity) - .containsOnly(tuple(ProjectDump.SoftwareQuality.MAINTAINABILITY, ProjectDump.Severity.HIGH), tuple(ProjectDump.SoftwareQuality.SECURITY, ProjectDump.Severity.BLOCKER)); + assertThat(issue.getImpactsList()).extracting(ProjectDump.Impact::getSoftwareQuality, ProjectDump.Impact::getSeverity, ProjectDump.Impact::getManualSeverity) + .containsOnly(tuple(ProjectDump.SoftwareQuality.MAINTAINABILITY, ProjectDump.Severity.HIGH, true), + tuple(ProjectDump.SoftwareQuality.SECURITY, ProjectDump.Severity.BLOCKER, false)); assertThat(issue.getMessageFormattingsList()) .isEqualTo(ExportIssuesStep.dbToDumpMessageFormatting(messageFormattings.getMessageFormattingList())); assertThat(issue.getCodeVariants()).isEqualTo(issueDto.getCodeVariantsString()); diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java index 0838d75e35b..44982ffe6d9 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java +++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/issue/ExportIssuesStep.java @@ -128,6 +128,7 @@ public class ExportIssuesStep implements ComputationStep { .map(impactDto -> ProjectDump.Impact.newBuilder() .setSoftwareQuality(ProjectDump.SoftwareQuality.valueOf(impactDto.getSoftwareQuality().name())) .setSeverity(ProjectDump.Severity.valueOf(impactDto.getSeverity().name())) + .setManualSeverity(impactDto.isManualSeverity()) .build()) .forEach(builder::addImpacts); } diff --git a/server/sonar-ce-task-projectanalysis/src/main/protobuf/project_dump.proto b/server/sonar-ce-task-projectanalysis/src/main/protobuf/project_dump.proto index e9847cea4c1..29ccf1c6cb2 100644 --- a/server/sonar-ce-task-projectanalysis/src/main/protobuf/project_dump.proto +++ b/server/sonar-ce-task-projectanalysis/src/main/protobuf/project_dump.proto @@ -131,6 +131,7 @@ message Issue { message Impact { SoftwareQuality software_quality = 1; Severity severity = 2; + bool manual_severity = 3; } // Stream of issues changelog stored in file issues_changelog.pb |