Skip to content

Commit 2868298

Browse files
committed
PLUGINAPI-122 Standard severities need to be mapped to all the five impact severities
1 parent dc2df61 commit 2868298

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog
2+
## 11.2
3+
* Standard Severity BLOCKER is now mapped to Software Quality Impact Severity BLOCKER
4+
* Standard Severity INFO is now mapped to Software Quality Impact Severity INFO
25

36
## 11.1
47
* Remove deprecation on `status` values `TO_REVIEW`, `REVIEWED` and related usages

plugin-api/src/main/java/org/sonar/api/server/rule/internal/ImpactMapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,15 @@ public static String convertToDeprecatedSeverity(Severity severity) {
9797
public static Severity convertToImpactSeverity(String ruleSeverity) {
9898
switch (ruleSeverity) {
9999
case BLOCKER:
100+
return Severity.BLOCKER;
100101
case CRITICAL:
101102
return Severity.HIGH;
102103
case MAJOR:
103104
return Severity.MEDIUM;
104105
case MINOR:
105-
case INFO:
106106
return Severity.LOW;
107+
case INFO:
108+
return Severity.INFO;
107109
default:
108110
throw new IllegalStateException("This severity value " + ruleSeverity + " is illegal.");
109111
}

plugin-api/src/test/java/org/sonar/api/server/rule/internal/ImpactMapperTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,17 @@ public void convertToSeverity_givenMinor_returnLow() {
152152
}
153153

154154
@Test
155-
public void convertToSeverity_givenInfo_returnLow() {
155+
public void convertToSeverity_givenInfo_returnInfo() {
156156
Severity severity = ImpactMapper.convertToImpactSeverity("INFO");
157157

158-
assertThat(severity).isEqualTo(LOW);
158+
assertThat(severity).isEqualTo(INFO);
159159
}
160160

161161
@Test
162-
public void convertToSeverity_givenBlocker_returnHigh() {
162+
public void convertToSeverity_givenBlocker_returnBlock() {
163163
Severity severity = ImpactMapper.convertToImpactSeverity("BLOCKER");
164164

165-
assertThat(severity).isEqualTo(HIGH);
165+
assertThat(severity).isEqualTo(BLOCKER);
166166
}
167167

168168
@Test

0 commit comments

Comments
 (0)