aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>2023-11-06 14:18:31 +0100
committersonartech <sonartech@sonarsource.com>2023-11-08 20:02:53 +0000
commit9f451cb3fb66e618e48278de7104e204b8695ef1 (patch)
treedf9b39d8845af59e02e7ed1ff67f456b148ce78e /sonar-core/src
parent34dffa98cc400f52b59826670c765a77e07316e9 (diff)
downloadsonarqube-9f451cb3fb66e618e48278de7104e204b8695ef1.tar.gz
sonarqube-9f451cb3fb66e618e48278de7104e204b8695ef1.zip
SONAR-20877 Update naming to issueStatus
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java6
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/status/IssueStatus.java (renamed from sonar-core/src/main/java/org/sonar/core/issue/status/SimpleStatus.java)22
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties18
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java10
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/status/IssueStatusTest.java (renamed from sonar-core/src/test/java/org/sonar/core/issue/status/SimpleStatusTest.java)42
5 files changed, 46 insertions, 52 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
index 955dfdc1939..f919ade4c22 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
@@ -48,7 +48,7 @@ import org.sonar.api.rule.Severity;
import org.sonar.api.rules.CleanCodeAttribute;
import org.sonar.api.rules.RuleType;
import org.sonar.api.utils.Duration;
-import org.sonar.core.issue.status.SimpleStatus;
+import org.sonar.core.issue.status.IssueStatus;
import org.sonar.core.issue.tracking.Trackable;
import static org.sonar.api.utils.DateUtils.truncateToSeconds;
@@ -345,9 +345,9 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
}
@Nullable
- public SimpleStatus getSimpleStatus() {
+ public IssueStatus getIssueStatus() {
Preconditions.checkArgument(!Strings.isNullOrEmpty(status), "Status must be set");
- return SimpleStatus.of(status, resolution);
+ return IssueStatus.of(status, resolution);
}
@Override
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/status/SimpleStatus.java b/sonar-core/src/main/java/org/sonar/core/issue/status/IssueStatus.java
index e2744d16182..93875e88dde 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/status/SimpleStatus.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/status/IssueStatus.java
@@ -25,7 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.issue.Issue;
-public enum SimpleStatus {
+public enum IssueStatus {
OPEN,
@@ -34,19 +34,19 @@ public enum SimpleStatus {
ACCEPTED,
FIXED;
- private static final Logger LOGGER = LoggerFactory.getLogger(SimpleStatus.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(IssueStatus.class);
@CheckForNull
- public static SimpleStatus of(String status, @Nullable String resolution) {
+ public static IssueStatus of(String status, @Nullable String resolution) {
switch (status) {
case Issue.STATUS_OPEN:
case Issue.STATUS_REOPENED:
- return SimpleStatus.OPEN;
+ return IssueStatus.OPEN;
case Issue.STATUS_CONFIRMED:
- return SimpleStatus.CONFIRMED;
+ return IssueStatus.CONFIRMED;
case Issue.STATUS_CLOSED:
- return SimpleStatus.FIXED;
- // Security hotspot should not return simple status as they are deprecated.
+ return IssueStatus.FIXED;
+ // Security hotspot should not return issue status as they are deprecated.
case Issue.STATUS_REVIEWED:
case Issue.STATUS_TO_REVIEW:
return null;
@@ -55,15 +55,15 @@ public enum SimpleStatus {
if (Issue.STATUS_RESOLVED.equals(status) && resolution != null) {
switch (resolution) {
case Issue.RESOLUTION_FALSE_POSITIVE:
- return SimpleStatus.FALSE_POSITIVE;
+ return IssueStatus.FALSE_POSITIVE;
case Issue.RESOLUTION_WONT_FIX:
- return SimpleStatus.ACCEPTED;
+ return IssueStatus.ACCEPTED;
case Issue.RESOLUTION_FIXED:
- return SimpleStatus.FIXED;
+ return IssueStatus.FIXED;
default:
}
}
- LOGGER.warn("Can't find mapped simple status for status '{}' and resolution '{}'", status, resolution);
+ LOGGER.warn("Can't find mapped issue status for status '{}' and resolution '{}'", status, resolution);
return null;
}
}
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 5be65c97f7a..61e90368830 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1054,11 +1054,11 @@ issue.clean_code_attribute.TRUSTWORTHY=Not trustworthy
issue.clean_code_attribute.TRUSTWORTHY.title=This is a responsibility issue, the code is not trustworthy enough.
issue.clean_code_attribute.TRUSTWORTHY.advice=To be trustworthy, the code needs to abstain from revealing or hard-coding private information.
-issue.simple_status.OPEN=Open
-issue.simple_status.ACCEPTED=Accepted
-issue.simple_status.CONFIRMED=Confirmed
-issue.simple_status.FIXED=Fixed
-issue.simple_status.FALSE_POSITIVE=False Positive
+issue.issue_status.OPEN=Open
+issue.issue_status.ACCEPTED=Accepted
+issue.issue_status.CONFIRMED=Confirmed
+issue.issue_status.FIXED=Fixed
+issue.issue_status.FALSE_POSITIVE=False Positive
issue.status.ACCEPTED=Accepted
issue.status.REOPENED=Reopened
@@ -1070,12 +1070,6 @@ issue.status.TO_REVIEW=To Review
issue.status.IN_REVIEW=In Review
issue.status.REVIEWED=Reviewed
-issue.simple_status.OPEN=Open
-issue.simple_status.ACCEPTED=Accepted
-issue.simple_status.CONFIRMED=Confirmed
-issue.simple_status.FIXED=Fixed
-issue.simple_status.FALSE_POSITIVE=False Positive
-
issue.scope.MAIN=Main code
issue.scope.TEST=Test code
@@ -1180,7 +1174,7 @@ issues.facet.types=Type
issues.facet.severities=Severity
issues.facet.scopes=Scope
issues.facet.projects=Project
-issues.facet.simpleStatuses=Status
+issues.facet.issueStatuses=Status
issues.facet.hotspotStatuses=Hotspot Status
issues.facet.assignees=Assignee
issues.facet.files=File
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
index 4c1da1c1a16..baae9a88dd6 100644
--- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java
@@ -27,7 +27,7 @@ import org.sonar.api.issue.Issue;
import org.sonar.api.issue.impact.Severity;
import org.sonar.api.issue.impact.SoftwareQuality;
import org.sonar.api.utils.Duration;
-import org.sonar.core.issue.status.SimpleStatus;
+import org.sonar.core.issue.status.IssueStatus;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -305,18 +305,18 @@ public class DefaultIssueTest {
}
@Test
- public void getSimpleStatus_shouldReturnExpectedStatus() {
+ public void getIssueStatus_shouldReturnExpectedStatus() {
issue.setStatus(Issue.STATUS_RESOLVED);
issue.setResolution(Issue.RESOLUTION_FIXED);
- assertThat(issue.getSimpleStatus()).isEqualTo(SimpleStatus.FIXED);
+ assertThat(issue.getIssueStatus()).isEqualTo(IssueStatus.FIXED);
}
@Test
- public void getSimpleStatus_shouldThrowException_whenStatusNotSet() {
+ public void getIssueStatus_shouldThrowException_whenStatusNotSet() {
issue.setResolution(Issue.RESOLUTION_FIXED);
- assertThatThrownBy(issue::getSimpleStatus)
+ assertThatThrownBy(issue::getIssueStatus)
.hasMessage("Status must be set")
.isInstanceOf(IllegalArgumentException.class);
}
diff --git a/sonar-core/src/test/java/org/sonar/core/issue/status/SimpleStatusTest.java b/sonar-core/src/test/java/org/sonar/core/issue/status/IssueStatusTest.java
index 2e4ba579fdf..c3c8eef6513 100644
--- a/sonar-core/src/test/java/org/sonar/core/issue/status/SimpleStatusTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/issue/status/IssueStatusTest.java
@@ -27,51 +27,51 @@ import org.sonar.api.testfixtures.log.LogTester;
import static org.assertj.core.api.Assertions.assertThat;
-public class SimpleStatusTest {
+public class IssueStatusTest {
@Rule
public LogTester logTester = new LogTester();
@Test
- public void of_shouldMapToCorrectSimpleStatus() {
- assertThat(SimpleStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_FIXED))
- .isEqualTo(SimpleStatus.FIXED);
+ public void of_shouldMapToCorrectIssueStatus() {
+ assertThat(IssueStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_FIXED))
+ .isEqualTo(IssueStatus.FIXED);
- assertThat(SimpleStatus.of(Issue.STATUS_CONFIRMED, null))
- .isEqualTo(SimpleStatus.CONFIRMED);
+ assertThat(IssueStatus.of(Issue.STATUS_CONFIRMED, null))
+ .isEqualTo(IssueStatus.CONFIRMED);
- assertThat(SimpleStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_FALSE_POSITIVE))
- .isEqualTo(SimpleStatus.FALSE_POSITIVE);
+ assertThat(IssueStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_FALSE_POSITIVE))
+ .isEqualTo(IssueStatus.FALSE_POSITIVE);
- assertThat(SimpleStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_WONT_FIX))
- .isEqualTo(SimpleStatus.ACCEPTED);
+ assertThat(IssueStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_WONT_FIX))
+ .isEqualTo(IssueStatus.ACCEPTED);
- assertThat(SimpleStatus.of(Issue.STATUS_REOPENED, null))
- .isEqualTo(SimpleStatus.OPEN);
+ assertThat(IssueStatus.of(Issue.STATUS_REOPENED, null))
+ .isEqualTo(IssueStatus.OPEN);
- assertThat(SimpleStatus.of(Issue.STATUS_CLOSED, null))
- .isEqualTo(SimpleStatus.FIXED);
+ assertThat(IssueStatus.of(Issue.STATUS_CLOSED, null))
+ .isEqualTo(IssueStatus.FIXED);
}
@Test
public void of_shouldReturnNull_WhenStatusBelongsToHotspot() {
- assertThat(SimpleStatus.of(Issue.STATUS_TO_REVIEW, null))
+ assertThat(IssueStatus.of(Issue.STATUS_TO_REVIEW, null))
.isNull();
- assertThat(SimpleStatus.of(Issue.STATUS_REVIEWED, Issue.RESOLUTION_SAFE))
+ assertThat(IssueStatus.of(Issue.STATUS_REVIEWED, Issue.RESOLUTION_SAFE))
.isNull();
- assertThat(SimpleStatus.of(Issue.STATUS_REVIEWED, Issue.RESOLUTION_ACKNOWLEDGED))
+ assertThat(IssueStatus.of(Issue.STATUS_REVIEWED, Issue.RESOLUTION_ACKNOWLEDGED))
.isNull();
}
@Test
public void of_shouldThrowExceptionWhenUnknownMapping() {
- assertThat(SimpleStatus.of(Issue.STATUS_RESOLVED, null)).isNull();
- assertThat(logTester.getLogs()).extracting(LogAndArguments::getFormattedMsg).contains("Can't find mapped simple status for status 'RESOLVED' and resolution 'null'");
+ assertThat(IssueStatus.of(Issue.STATUS_RESOLVED, null)).isNull();
+ assertThat(logTester.getLogs()).extracting(LogAndArguments::getFormattedMsg).contains("Can't find mapped issue status for status 'RESOLVED' and resolution 'null'");
- assertThat(SimpleStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_SAFE)).isNull();
- assertThat(logTester.getLogs()).extracting(LogAndArguments::getFormattedMsg).contains("Can't find mapped simple status for status 'RESOLVED' and resolution 'SAFE'");
+ assertThat(IssueStatus.of(Issue.STATUS_RESOLVED, Issue.RESOLUTION_SAFE)).isNull();
+ assertThat(logTester.getLogs()).extracting(LogAndArguments::getFormattedMsg).contains("Can't find mapped issue status for status 'RESOLVED' and resolution 'SAFE'");
}
}