diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2024-03-13 11:50:12 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-03-13 20:02:31 +0000 |
commit | c91516a230798e765f03adaba859a5283e74bae0 (patch) | |
tree | c0f6bf89249baeceaf06c0d5bae93c01d453024e | |
parent | 7cae13df570f80a8a49cbf192184d2fdc4321c42 (diff) | |
download | sonarqube-c91516a230798e765f03adaba859a5283e74bae0.tar.gz sonarqube-c91516a230798e765f03adaba859a5283e74bae0.zip |
SONAR-21799 Deprecate metrics based on old types and severities
6 files changed, 29 insertions, 4 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java index 58a82e30f15..3356cd598e8 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java @@ -96,7 +96,10 @@ public class ComponentAction implements MeasuresWsAction { .setResponseExample(getClass().getResource("component-example.json")) .setSince("5.4") .setChangelog( - new Change("10.4", String.format("The metrics %s are now deprecated in the response " + + new Change("10.5", String.format("The metrics %s are now deprecated " + + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", + MeasuresWsModule.getDeprecatedMetricsInSonarQube105())), + new Change("10.4", String.format("The metrics %s are now deprecated " + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", MeasuresWsModule.getDeprecatedMetricsInSonarQube104())), new Change("10.4", "Added new accepted values for the 'metricKeys' param: 'maintainability_issues', 'reliability_issues', 'security_issues'"), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java index 3749ec2ab0b..3e65aee8c97 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java @@ -184,8 +184,11 @@ public class ComponentTreeAction implements MeasuresWsAction { .setHandler(this) .addPagingParams(100, MAX_SIZE) .setChangelog( + new Change("10.5", String.format("The metrics %s are now deprecated " + + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", + MeasuresWsModule.getDeprecatedMetricsInSonarQube105())), new Change("10.5", "Added new accepted values for the 'metricKeys' param: 'maintainability_issues', 'reliability_issues', 'security_issues'"), - new Change("10.4", String.format("The metrics %s are now deprecated in the response " + + new Change("10.4", String.format("The metrics %s are now deprecated " + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", MeasuresWsModule.getDeprecatedMetricsInSonarQube104())), new Change("10.4", "The metrics 'open_issues', 'reopened_issues' and 'confirmed_issues' are now deprecated in the response. Consume 'violations' instead."), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/MeasuresWsModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/MeasuresWsModule.java index 9a452090d9a..710f7479379 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/MeasuresWsModule.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/MeasuresWsModule.java @@ -43,4 +43,9 @@ public class MeasuresWsModule extends Module { return "'" + String.join("', '","bugs", "new_bugs", "vulnerabilities", "new_vulnerabilities", "code_smells", "new_code_smells", "high_impact_accepted_issues") + "'"; } + + public static String getDeprecatedMetricsInSonarQube105() { + return "'" + String.join("', '", "new_blocker_violations", "new_critical_violations", "new_major_violations", "new_minor_violations", + "new_info_violations", "blocker_violations", "critical_violations", "major_violations", "minor_violations", "info_violations") + "'"; + } } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java index cb2ba56e9c2..fc9743db4ea 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchAction.java @@ -87,7 +87,10 @@ public class SearchAction implements MeasuresWsAction { .setResponseExample(getClass().getResource("search-example.json")) .setHandler(this) .setChangelog( - new Change("10.4", String.format("The metrics %s are now deprecated in the response " + + new Change("10.5", String.format("The metrics %s are now deprecated " + + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", + MeasuresWsModule.getDeprecatedMetricsInSonarQube105())), + new Change("10.4", String.format("The metrics %s are now deprecated " + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", MeasuresWsModule.getDeprecatedMetricsInSonarQube104())), new Change("10.4", "Added new accepted values for the 'metricKeys' param: 'maintainability_issues', 'reliability_issues', 'security_issues'"), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java index 6fcf78f738a..1c63a887e3f 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/SearchHistoryAction.java @@ -95,7 +95,10 @@ public class SearchHistoryAction implements MeasuresWsAction { .setResponseExample(getClass().getResource("search_history-example.json")) .setSince("6.3") .setChangelog( - new Change("10.4", String.format("The metrics %s are now deprecated in the response " + + new Change("10.5", String.format("The metrics %s are now deprecated " + + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", + MeasuresWsModule.getDeprecatedMetricsInSonarQube105())), + new Change("10.4", String.format("The metrics %s are now deprecated " + "without exact replacement. Use 'maintainability_issues', 'reliability_issues' and 'security_issues' instead.", MeasuresWsModule.getDeprecatedMetricsInSonarQube104())), new Change("10.4", "The metrics 'open_issues', 'reopened_issues' and 'confirmed_issues' are now deprecated in the response. Consume 'violations' instead."), diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/MeasuresWsModuleTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/MeasuresWsModuleTest.java index a272c9cbbac..ff9c933a0bf 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/MeasuresWsModuleTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/MeasuresWsModuleTest.java @@ -39,4 +39,12 @@ public class MeasuresWsModuleTest { assertThat(actual).isEqualTo("'bugs', 'new_bugs', 'vulnerabilities', 'new_vulnerabilities', 'code_smells', 'new_code_smells', " + "'high_impact_accepted_issues'"); } + + @Test + public void getDeprecatedMetricsInSonarQube105_shouldReturnExactString() { + String actual = MeasuresWsModule.getDeprecatedMetricsInSonarQube105(); + + assertThat(actual).isEqualTo("'new_blocker_violations', 'new_critical_violations', 'new_major_violations', 'new_minor_violations', " + + "'new_info_violations', 'blocker_violations', 'critical_violations', 'major_violations', 'minor_violations', 'info_violations'"); + } } |