]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18746 Drop periodIndex field related to periods
authorMatteo Mara <matteo.mara@sonarsource.com>
Thu, 30 Mar 2023 11:59:54 +0000 (13:59 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 30 Mar 2023 20:03:07 +0000 (20:03 +0000)
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatter.java
server/sonar-webserver-webapi/src/main/resources/org/sonar/server/qualitygate/ws/project_status-example.json
server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/QualityGateDetailsFormatterTest.java
sonar-ws/src/main/protobuf/ws-qualitygates.proto

index 456ae51975c251e498bc29ae8610e8b12b4a1bcd..033b2a3849c925cb81417b9c38938a276196e404 100644 (file)
@@ -96,7 +96,7 @@ public class ProjectStatusAction implements QualityGatesWsAction {
       .setSince("5.3")
       .setHandler(this)
       .setChangelog(
-        new Change("10.0", "The field 'periods' in the response is removed"),
+        new Change("10.0", "The fields 'periods' and 'periodIndex' in the response are removed"),
         new Change("9.9", "'caycStatus' field is added to the response"),
         new Change("9.5", "The 'Execute Analysis' permission also allows to access the endpoint"),
         new Change("8.5", "The field 'periods' in the response is deprecated. Use 'period' instead"),
index b8715debe222b4f092b2ab0b8a5f0c7489336fb7..2376f2ea77620093e5c3f3233b83c029181ba594 100644 (file)
@@ -120,7 +120,6 @@ public class QualityGateDetailsFormatter {
     formatConditionLevel(conditionBuilder, jsonCondition);
     formatConditionMetric(conditionBuilder, jsonCondition);
     formatConditionOperation(conditionBuilder, jsonCondition);
-    formatConditionPeriod(conditionBuilder, jsonCondition);
     formatConditionWarningThreshold(conditionBuilder, jsonCondition);
     formatConditionErrorThreshold(conditionBuilder, jsonCondition);
     formatConditionActual(conditionBuilder, jsonCondition);
@@ -149,14 +148,6 @@ public class QualityGateDetailsFormatter {
     }
   }
 
-  private static void formatConditionPeriod(ProjectStatusResponse.Condition.Builder conditionBuilder, JsonObject jsonCondition) {
-    JsonElement periodIndex = jsonCondition.get("period");
-    if (periodIndex == null) {
-      return;
-    }
-    conditionBuilder.setPeriodIndex(periodIndex.getAsInt());
-  }
-
   private static void formatConditionOperation(ProjectStatusResponse.Condition.Builder conditionBuilder, JsonObject jsonCondition) {
     JsonElement op = jsonCondition.get("op");
     if (op != null && !isNullOrEmpty(op.getAsString())) {
index 686493327cf7155c97b739a12a91209391e81f0a..e265a5f5c65236a967c99c92af7e527729b7850e 100644 (file)
@@ -8,7 +8,6 @@
         "status": "ERROR",
         "metricKey": "new_coverage",
         "comparator": "LT",
-        "periodIndex": 1,
         "errorThreshold": "85",
         "actualValue": "82.50562381034781"
       },
@@ -16,7 +15,6 @@
         "status": "ERROR",
         "metricKey": "new_blocker_violations",
         "comparator": "GT",
-        "periodIndex": 1,
         "errorThreshold": "0",
         "actualValue": "14"
       },
@@ -24,7 +22,6 @@
         "status": "ERROR",
         "metricKey": "new_critical_violations",
         "comparator": "GT",
-        "periodIndex": 1,
         "errorThreshold": "0",
         "actualValue": "1"
       },
@@ -32,7 +29,6 @@
         "status": "OK",
         "metricKey": "new_sqale_debt_ratio",
         "comparator": "GT",
-        "periodIndex": 1,
         "errorThreshold": "5",
         "actualValue": "0.6562109862671661"
       },
         "status": "OK",
         "metricKey": "reopened_issues",
         "comparator": "GT",
-        "periodIndex": 1,
         "actualValue": "0"
       },
       {
         "status": "ERROR",
         "metricKey": "open_issues",
         "comparator": "GT",
-        "periodIndex": 1,
         "actualValue": "17"
       },
       {
         "status": "OK",
         "metricKey": "skipped_tests",
         "comparator": "GT",
-        "periodIndex": 1,
         "actualValue": "0"
       }
     ],
index ca7fec90ce62b90dd46879982b0a6e7b458997f2..c2c15b7427512459d40c5426c1cd1864f68af7e1 100644 (file)
@@ -63,7 +63,6 @@ public class QualityGateDetailsFormatterTest {
       ProjectStatusResponse.Comparator.LT,
       ProjectStatusResponse.Comparator.GT,
       ProjectStatusResponse.Comparator.GT);
-    assertThat(conditions).extracting("periodIndex").containsExactly(1, 1, 1);
     assertThat(conditions).extracting("warningThreshold").containsOnly("80", "");
     assertThat(conditions).extracting("errorThreshold").containsOnly("85", "0", "0");
     assertThat(conditions).extracting("actualValue").containsExactly("82.2985024398452", "1", "0");
@@ -92,7 +91,6 @@ public class QualityGateDetailsFormatterTest {
     assertThat(conditions).extracting("status").containsExactly(ProjectStatusResponse.Status.ERROR);
     assertThat(conditions).extracting("metricKey").containsExactly("new_coverage");
     assertThat(conditions).extracting("comparator").containsExactly(ProjectStatusResponse.Comparator.LT);
-    assertThat(conditions).extracting("periodIndex").containsExactly(1);
     assertThat(conditions).extracting("errorThreshold").containsOnly("85");
     assertThat(conditions).extracting("actualValue").containsExactly("82.2985024398452");
   }
index 8c9d4fbf96286ed43ba46da8c379234f875bd817..06dfa914fc14e7c8b2de1da6d4ad7e7d63dbe9d5 100644 (file)
@@ -43,7 +43,7 @@ message ProjectStatusResponse {
     optional Status status = 1;
     optional string metricKey = 2;
     optional Comparator comparator = 3;
-    optional int32 periodIndex = 4;
+    reserved 4; //drop periodIndex
     optional string warningThreshold = 5;
     optional string errorThreshold = 6;
     optional string actualValue = 7;