aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorbelen-pruvost-sonarsource <belen.pruvost@sonarsource.com>2022-01-21 10:43:10 +0100
committersonartech <sonartech@sonarsource.com>2022-01-21 20:03:22 +0000
commite2ee8eeba4e3c7b08cd929c56d0fb136d1cdf372 (patch)
tree08dd8921d0d8714e6593d31832b66e606ade5bfb /sonar-core
parent9d1361c43487f91b3d001a7e1385d35fa05a5115 (diff)
downloadsonarqube-e2ee8eeba4e3c7b08cd929c56d0fb136d1cdf372.tar.gz
sonarqube-e2ee8eeba4e3c7b08cd929c56d0fb136d1cdf372.zip
SONAR-14929 - Handle Issue no longer being new on feature branch
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java22
-rw-r--r--sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java4
2 files changed, 26 insertions, 0 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 89aa9a7fa3b..7d8a8874896 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
@@ -125,6 +125,10 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
private Long selectedAt;
private boolean quickFixAvailable;
+ private boolean isNewCodeReferenceIssue;
+
+ // true if the issue is no longer new in its branch
+ private boolean isNoLongerNewCodeReferenceIssue = false;
@Override
public String key() {
@@ -548,6 +552,24 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
return this;
}
+ public boolean isNewCodeReferenceIssue() {
+ return isNewCodeReferenceIssue;
+ }
+
+ public DefaultIssue setIsNewCodeReferenceIssue(boolean isNewCodeReferenceIssue) {
+ this.isNewCodeReferenceIssue = isNewCodeReferenceIssue;
+ return this;
+ }
+
+ public boolean isNoLongerNewCodeReferenceIssue() {
+ return isNoLongerNewCodeReferenceIssue;
+ }
+
+ public DefaultIssue setIsNoLongerNewCodeReferenceIssue(boolean isNoLongerNewCodeReferenceIssue) {
+ this.isNoLongerNewCodeReferenceIssue = isNoLongerNewCodeReferenceIssue;
+ return this;
+ }
+
@CheckForNull
public FieldDiffs currentChange() {
return currentChange;
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 874272d2d40..423dc536b00 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
@@ -58,6 +58,8 @@ public class DefaultIssueTest {
.setNew(true)
.setIsOnReferencedBranch(true)
.setIsOnChangedLine(true)
+ .setIsNewCodeReferenceIssue(true)
+ .setIsNoLongerNewCodeReferenceIssue(true)
.setBeingClosed(true)
.setOnDisabledRule(true)
.setCopied(true)
@@ -87,6 +89,8 @@ public class DefaultIssueTest {
assertThat(issue.isNew()).isTrue();
assertThat(issue.isOnReferencedBranch()).isTrue();
assertThat(issue.isOnChangedLine()).isTrue();
+ assertThat(issue.isNewCodeReferenceIssue()).isTrue();
+ assertThat(issue.isNoLongerNewCodeReferenceIssue()).isTrue();
assertThat(issue.isCopied()).isTrue();
assertThat(issue.isBeingClosed()).isTrue();
assertThat(issue.isOnDisabledRule()).isTrue();