From eaed27994e62b7a2889a363c499c2fc626b79076 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Tue, 15 Aug 2023 15:24:53 +0200 Subject: [PATCH] SONAR-20047 Deprecate endpoints and params related to rule or issue type and severity --- .../java/org/sonar/server/issue/ws/BulkChangeAction.java | 3 +++ .../org/sonar/server/issue/ws/SetSeverityAction.java | 2 ++ .../java/org/sonar/server/issue/ws/SetTypeAction.java | 2 ++ .../server/qualityprofile/ws/ActivateRuleAction.java | 4 ++++ .../server/qualityprofile/ws/ActivateRulesAction.java | 9 ++++++++- .../server/qualityprofile/ws/DeactivateRulesAction.java | 8 +++++++- .../java/org/sonar/server/rule/ws/RuleWsSupport.java | 3 +++ .../main/java/org/sonar/server/rule/ws/SearchAction.java | 4 ++-- 8 files changed, 31 insertions(+), 4 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java index 7f37b26e90f..e06368caf2f 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java @@ -150,6 +150,7 @@ public class BulkChangeAction implements IssuesWsAction { "Requires authentication.") .setSince("3.7") .setChangelog( + new Change("10.2", format("Parameters '%s' and '%s' are now deprecated.", PARAM_SET_SEVERITY, PARAM_SET_TYPE)), new Change("8.2", "Security hotspots are no longer supported and will be ignored."), new Change("8.2", format("transitions '%s', '%s' and '%s' are no more supported", SET_AS_IN_REVIEW, RESOLVE_AS_REVIEWED, OPEN_AS_VULNERABILITY)), new Change("6.3", "'actions' parameter is ignored")) @@ -166,10 +167,12 @@ public class BulkChangeAction implements IssuesWsAction { .setExampleValue("john.smith"); action.createParam(PARAM_SET_SEVERITY) .setDescription("To change the severity of the list of issues") + .setDeprecatedSince("10.2") .setExampleValue(BLOCKER) .setPossibleValues(Severity.ALL); action.createParam(PARAM_SET_TYPE) .setDescription("To change the type of the list of issues") + .setDeprecatedSince("10.2") .setExampleValue(BUG) .setPossibleValues(RuleType.names()) .setSince("5.5"); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java index d5ce9ebe9e1..485d500773a 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetSeverityAction.java @@ -79,11 +79,13 @@ public class SetSeverityAction implements IssuesWsAction { "") .setSince("3.6") .setChangelog( + new Change("10.2", "This endpoint is now deprecated."), new Change("9.6", "Response field 'ruleDescriptionContextKey' added"), new Change("8.8", "The response field components.uuid is removed"), new Change("6.5", "the database ids of the components are removed from the response"), new Change("6.5", "the response field components.uuid is deprecated. Use components.key instead.")) .setHandler(this) + .setDeprecatedSince("10.2") .setResponseExample(Resources.getResource(this.getClass(), "set_severity-example.json")) .setPost(true); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java index dbaf40cfd1f..bf49aa4d895 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTypeAction.java @@ -83,11 +83,13 @@ public class SetTypeAction implements IssuesWsAction { "") .setSince("5.5") .setChangelog( + new Change("10.2", "This endpoint is now deprecated."), new Change("9.6", "Response field 'ruleDescriptionContextKey' added"), new Change("8.8", "The response field components.uuid is removed"), new Change("6.5", "the database ids of the components are removed from the response"), new Change("6.5", "the response field components.uuid is deprecated. Use components.key instead.")) .setHandler(this) + .setDeprecatedSince("10.2") .setResponseExample(Resources.getResource(this.getClass(), "set_type-example.json")) .setPost(true); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java index 29c84a7ca94..cf4bd2960ee 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java @@ -22,6 +22,7 @@ package org.sonar.server.qualityprofile.ws; import java.util.Map; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.Severity; +import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -67,6 +68,8 @@ public class ActivateRuleAction implements QProfileWsAction { "
  • 'Administer Quality Profiles'
  • " + "
  • Edit right on the specified quality profile
  • " + "") + .setChangelog( + new Change("10.2", format("Parameter '%s' is now deprecated.", PARAM_SEVERITY))) .setHandler(this) .setPost(true) .setSince("4.4"); @@ -83,6 +86,7 @@ public class ActivateRuleAction implements QProfileWsAction { activate.createParam(PARAM_SEVERITY) .setDescription(format("Severity. Ignored if parameter %s is true.", PARAM_RESET)) + .setDeprecatedSince("10.2") .setPossibleValues(Severity.ALL); activate.createParam(PARAM_PARAMS) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRulesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRulesAction.java index 13c76798138..e3b549f8554 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRulesAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRulesAction.java @@ -33,10 +33,14 @@ import org.sonar.server.rule.index.RuleQuery; import org.sonar.server.rule.ws.RuleQueryFactory; import org.sonar.server.user.UserSession; +import static java.lang.String.format; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_03; import static org.sonar.server.qualityprofile.ws.BulkChangeWsResponse.writeResponse; import static org.sonar.server.qualityprofile.ws.QProfileReference.fromKey; import static org.sonar.server.rule.ws.RuleWsSupport.defineGenericRuleSearchParameters; +import static org.sonar.server.rule.ws.RulesWsParameters.PARAM_ACTIVE_SEVERITIES; +import static org.sonar.server.rule.ws.RulesWsParameters.PARAM_SEVERITIES; +import static org.sonar.server.rule.ws.RulesWsParameters.PARAM_TYPES; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_ACTIVATE_RULES; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_KEY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_SEVERITY; @@ -68,7 +72,9 @@ public class ActivateRulesAction implements QProfileWsAction { "") .setPost(true) .setSince("4.4") - .setChangelog(new Change("10.0", "Parameter 'sansTop25' is deprecated")) + .setChangelog( + new Change("10.2", format("Parameters '%s', '%s', '%s', and '%s' are now deprecated.", PARAM_SEVERITIES, PARAM_TARGET_SEVERITY, PARAM_ACTIVE_SEVERITIES, PARAM_TYPES)), + new Change("10.0", "Parameter 'sansTop25' is deprecated")) .setHandler(this); defineGenericRuleSearchParameters(activate); @@ -80,6 +86,7 @@ public class ActivateRulesAction implements QProfileWsAction { activate.createParam(PARAM_TARGET_SEVERITY) .setDescription("Severity to set on the activated rules") + .setDeprecatedSince("10.2") .setPossibleValues(Severity.ALL); } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRulesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRulesAction.java index 3d284ccb4d4..04dfb30bc55 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRulesAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRulesAction.java @@ -32,9 +32,13 @@ import org.sonar.server.rule.index.RuleQuery; import org.sonar.server.rule.ws.RuleQueryFactory; import org.sonar.server.user.UserSession; +import static java.lang.String.format; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_04; import static org.sonar.server.qualityprofile.ws.BulkChangeWsResponse.writeResponse; import static org.sonar.server.rule.ws.RuleWsSupport.defineGenericRuleSearchParameters; +import static org.sonar.server.rule.ws.RulesWsParameters.PARAM_ACTIVE_SEVERITIES; +import static org.sonar.server.rule.ws.RulesWsParameters.PARAM_SEVERITIES; +import static org.sonar.server.rule.ws.RulesWsParameters.PARAM_TYPES; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.ACTION_DEACTIVATE_RULES; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_TARGET_KEY; @@ -65,7 +69,9 @@ public class DeactivateRulesAction implements QProfileWsAction { "") .setPost(true) .setSince("4.4") - .setChangelog(new Change("10.0", "Parameter 'sansTop25' is deprecated")) + .setChangelog( + new Change("10.2", format("Parameters '%s', '%s', and '%s' are now deprecated.", PARAM_SEVERITIES, PARAM_ACTIVE_SEVERITIES, PARAM_TYPES)), + new Change("10.0", "Parameter 'sansTop25' is deprecated")) .setHandler(this); defineGenericRuleSearchParameters(deactivate); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java index 58702cedae1..8709adf771e 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java @@ -112,6 +112,7 @@ public class RuleWsSupport { .createParam(PARAM_SEVERITIES) .setDescription("Comma-separated list of default severities. Not the same than severity of rules in Quality profiles.") .setPossibleValues(Severity.ALL) + .setDeprecatedSince("10.2") .setExampleValue("CRITICAL,BLOCKER"); action @@ -169,6 +170,7 @@ public class RuleWsSupport { .setSince("5.5") .setDescription("Comma-separated list of types. Returned rules match any of the tags (OR operator)") .setPossibleValues(RuleType.values()) + .setDeprecatedSince("10.2") .setExampleValue(RuleType.BUG); action @@ -203,6 +205,7 @@ public class RuleWsSupport { .createParam(PARAM_ACTIVE_SEVERITIES) .setDescription("Comma-separated list of activation severities, i.e the severity of rules in Quality profiles.") .setPossibleValues(Severity.ALL) + .setDeprecatedSince("10.2") .setExampleValue("CRITICAL,BLOCKER"); action diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/SearchAction.java index 8f52faa0822..f4cf74b5b2a 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/SearchAction.java @@ -165,8 +165,8 @@ public class SearchAction implements RulesWsAction { new Change("10.0", "The value 'debtRemFn' for the 'f' parameter has been deprecated, use 'remFn' instead"), new Change("10.0", "The value 'defaultDebtRemFn' for the 'f' parameter has been deprecated, use 'defaultRemFn' instead"), new Change("10.0", "The value 'sansTop25' for the parameter 'facets' has been deprecated"), - new Change("10.0", "Parameter 'sansTop25' is deprecated") - ); + new Change("10.0", "Parameter 'sansTop25' is deprecated"), + new Change("10.2", format("Parameters '%s', '%s', and '%s' are now deprecated.", PARAM_SEVERITIES, PARAM_TYPES, PARAM_ACTIVE_SEVERITIES))); action.createParam(FACETS) .setDescription("Comma-separated list of the facets to be computed. No facet is computed by default.") -- 2.39.5