aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task-projectanalysis
diff options
context:
space:
mode:
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>2023-11-06 11:50:35 +0100
committersonartech <sonartech@sonarsource.com>2023-11-08 20:02:53 +0000
commit2aecd1cb1b0c4bd69216f80195f2a97b31c1788f (patch)
tree4ad6c94a56a4f158c30f2264a70ad95ec1391875 /server/sonar-ce-task-projectanalysis
parent50a50c28aeb2d1138f3ec0ae1e70031f74ad6e5e (diff)
downloadsonarqube-2aecd1cb1b0c4bd69216f80195f2a97b31c1788f.tar.gz
sonarqube-2aecd1cb1b0c4bd69216f80195f2a97b31c1788f.zip
SONAR-20877 Update counters to compute new status
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java7
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java4
2 files changed, 5 insertions, 6 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java
index 389f862adbe..1d2e2cbc100 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java
@@ -33,9 +33,8 @@ import org.sonar.ce.task.projectanalysis.measure.MeasureRepository;
import org.sonar.ce.task.projectanalysis.metric.Metric;
import org.sonar.ce.task.projectanalysis.metric.MetricRepository;
import org.sonar.core.issue.DefaultIssue;
+import org.sonar.core.issue.status.IssueStatus;
-import static org.sonar.api.issue.Issue.RESOLUTION_FALSE_POSITIVE;
-import static org.sonar.api.issue.Issue.RESOLUTION_WONT_FIX;
import static org.sonar.api.issue.Issue.STATUS_CONFIRMED;
import static org.sonar.api.issue.Issue.STATUS_OPEN;
import static org.sonar.api.issue.Issue.STATUS_REOPENED;
@@ -247,9 +246,9 @@ public class IssueCounter extends IssueVisitor {
unresolved++;
typeBag.add(issue.type());
severityBag.add(issue.severity());
- } else if (RESOLUTION_FALSE_POSITIVE.equals(issue.resolution())) {
+ } else if (IssueStatus.FALSE_POSITIVE.equals(issue.getIssueStatus())) {
falsePositives++;
- } else if (RESOLUTION_WONT_FIX.equals(issue.resolution())) {
+ } else if (IssueStatus.ACCEPTED.equals(issue.getIssueStatus())) {
accepted++;
}
switch (issue.status()) {
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java
index a6d26b3b7c2..1646b2dc05d 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssueCounterTest.java
@@ -185,13 +185,13 @@ public class IssueCounterTest {
underTest.onIssue(FILE1, createIssue(null, STATUS_OPEN, BLOCKER));
underTest.onIssue(FILE1, createIssue(RESOLUTION_FIXED, STATUS_CLOSED, MAJOR));
underTest.onIssue(FILE1, createIssue(RESOLUTION_FALSE_POSITIVE, STATUS_RESOLVED, MAJOR));
- underTest.onIssue(FILE1, createIssue(RESOLUTION_WONT_FIX, STATUS_CLOSED, MAJOR));
+ underTest.onIssue(FILE1, createIssue(RESOLUTION_WONT_FIX, STATUS_RESOLVED, MAJOR));
underTest.afterComponent(FILE1);
underTest.beforeComponent(FILE2);
underTest.onIssue(FILE2, createIssue(null, STATUS_CONFIRMED, BLOCKER));
underTest.onIssue(FILE2, createIssue(null, STATUS_CONFIRMED, MAJOR));
- underTest.onIssue(FILE2, createIssue(RESOLUTION_WONT_FIX, STATUS_CLOSED, MAJOR));
+ underTest.onIssue(FILE2, createIssue(RESOLUTION_WONT_FIX, STATUS_RESOLVED, MAJOR));
underTest.afterComponent(FILE2);
underTest.beforeComponent(FILE3);