From 752c801152e6701e106603b09ee7850deb1ae546 Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A9o=20Geoffroy?= Date: Mon, 21 Oct 2024 17:57:09 +0200 Subject: [PATCH] SONAR-23325 Add changelog for new severities introduced (INFO, BLOCKER) --- .../sonar/server/issue/ws/AddCommentAction.java | 3 +++ .../org/sonar/server/issue/ws/AssignAction.java | 3 +++ .../sonar/server/issue/ws/DoTransitionAction.java | 2 ++ .../sonar/server/issue/ws/EditCommentAction.java | 2 ++ .../org/sonar/server/issue/ws/SearchAction.java | 14 +++++++++++--- .../org/sonar/server/issue/ws/SetTagsAction.java | 5 ++++- .../server/qualityprofile/ws/ChangelogAction.java | 11 ++++++----- .../server/qualityprofile/ws/CompareAction.java | 7 +++++-- .../org/sonar/server/rule/ws/SearchAction.java | 6 ++++++ .../java/org/sonar/server/rule/ws/ShowAction.java | 7 ++++++- 10 files changed, 48 insertions(+), 12 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java index 14b7a96a709..7ac5031d4b8 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AddCommentAction.java @@ -21,6 +21,7 @@ package org.sonar.server.issue.ws; import com.google.common.io.Resources; import java.util.Date; +import org.sonar.api.issue.impact.Severity; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -38,6 +39,7 @@ import org.sonarqube.ws.client.issue.IssuesWsParameters; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Strings.isNullOrEmpty; +import static java.lang.String.format; import static java.util.Objects.requireNonNull; import static org.sonar.core.issue.IssueChangeContext.issueChangeContextByUserBuilder; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; @@ -72,6 +74,7 @@ public class AddCommentAction implements IssuesWsAction { "Requires authentication and the following permission: 'Browse' on the project of the specified issue.") .setSince("3.6") .setChangelog( + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added.", Severity.INFO.name(), Severity.BLOCKER.name())), new Change("10.4", "The response fields 'severity' and 'type' are deprecated. Please use 'impacts' instead."), new Change("10.4", "The response fields 'status' and 'resolution' are deprecated. Please use 'issueStatus' instead."), new Change("10.4", "Add 'issueStatus' field to the response."), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AssignAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AssignAction.java index 4b355cc478a..6a8ea531005 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AssignAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/AssignAction.java @@ -24,6 +24,7 @@ import com.google.common.io.Resources; import java.util.Date; import javax.annotation.CheckForNull; import javax.annotation.Nullable; +import org.sonar.api.issue.impact.Severity; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -41,6 +42,7 @@ import org.sonar.server.issue.IssueFinder; import org.sonar.server.user.UserSession; import static com.google.common.base.Strings.emptyToNull; +import static java.lang.String.format; import static org.sonar.core.issue.IssueChangeContext.issueChangeContextByUserBuilder; import static org.sonar.server.exceptions.NotFoundException.checkFound; import static org.sonarqube.ws.client.issue.IssuesWsParameters.ACTION_ASSIGN; @@ -75,6 +77,7 @@ public class AssignAction implements IssuesWsAction { .setDescription("Assign/Unassign an issue. Requires authentication and Browse permission on project") .setSince("3.6") .setChangelog( + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added.", Severity.INFO.name(), Severity.BLOCKER.name())), new Change("10.4", "The response fields 'severity' and 'type' are deprecated. Please use 'impacts' instead."), new Change("10.4", "The response fields 'status' and 'resolution' are deprecated. Please use 'issueStatus' instead."), new Change("10.4", "Add 'issueStatus' field to the response."), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java index 44c3f178c1b..13c43f018fd 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/DoTransitionAction.java @@ -22,6 +22,7 @@ package org.sonar.server.issue.ws; import com.google.common.io.Resources; import java.util.Date; import org.sonar.api.issue.DefaultTransitions; +import org.sonar.api.issue.impact.Severity; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -84,6 +85,7 @@ public class DoTransitionAction implements IssuesWsAction { """.formatted(DefaultTransitions.ACCEPT, DefaultTransitions.WONT_FIX, DefaultTransitions.FALSE_POSITIVE)) .setSince("3.6") .setChangelog( + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added.", Severity.INFO.name(), Severity.BLOCKER.name())), new Change("10.4", "The transitions '%s' and '%s' are deprecated. Please use '%s' instead. The transition '%s' is deprecated too. " .formatted(DefaultTransitions.WONT_FIX, DefaultTransitions.CONFIRM, DefaultTransitions.ACCEPT, DefaultTransitions.UNCONFIRM)), new Change("10.4", "Add transition '%s'.".formatted(DefaultTransitions.ACCEPT)), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java index f76abc920a2..b225c475d1b 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/EditCommentAction.java @@ -21,6 +21,7 @@ package org.sonar.server.issue.ws; import com.google.common.io.Resources; import java.util.Objects; +import org.sonar.api.issue.impact.Severity; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -66,6 +67,7 @@ public class EditCommentAction implements IssuesWsAction { "Requires authentication and the following permission: 'Browse' on the project of the specified issue.") .setSince("3.6") .setChangelog( + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added.", Severity.INFO.name(), Severity.BLOCKER.name())), new Change("10.4", "The response fields 'severity' and 'type' are deprecated. Please use 'impacts' instead."), new Change("10.4", "The response fields 'status' and 'resolution' are deprecated. Please use 'issueStatus' instead."), new Change("10.4", "Add 'issueStatus' field to the response."), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java index 12ddb6f846c..a076f62ab04 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -77,6 +77,11 @@ import static org.sonar.api.issue.Issue.STATUS_OPEN; import static org.sonar.api.issue.Issue.STATUS_REOPENED; import static org.sonar.api.issue.Issue.STATUS_REVIEWED; import static org.sonar.api.issue.Issue.STATUS_TO_REVIEW; +import static org.sonar.api.issue.impact.Severity.BLOCKER; +import static org.sonar.api.issue.impact.Severity.HIGH; +import static org.sonar.api.issue.impact.Severity.INFO; +import static org.sonar.api.issue.impact.Severity.MEDIUM; +import static org.sonar.api.issue.impact.Severity.values; import static org.sonar.api.server.ws.WebService.Param.FACETS; import static org.sonar.api.utils.Paging.forPageIndex; import static org.sonar.server.es.SearchOptions.MAX_PAGE_SIZE; @@ -217,6 +222,9 @@ public class SearchAction implements IssuesWsAction { + "
When issue indexing is in progress returns 503 service unavailable HTTP code.") .setSince("3.6") .setChangelog( + new Change("10.8", format("Possible values '%s' and '%s' for response field 'impactSeverities' of 'facets' have been added.", INFO.name(), BLOCKER.name())), + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added.", INFO.name(), BLOCKER.name())), + new Change("10.8", format("Parameter '%s' now supports values: '%s','%s'.", PARAM_SEVERITIES, INFO.name(), BLOCKER.name())), new Change("10.7", format(NEW_FACET_ADDED_MESSAGE, PARAM_CASA)), new Change("10.7", format(NEW_PARAM_ADDED_MESSAGE, PARAM_CASA)), new Change("10.7", format(NEW_FACET_ADDED_MESSAGE, PARAM_STIG_ASD_V5R3)), @@ -320,8 +328,8 @@ public class SearchAction implements IssuesWsAction { action.createParam(PARAM_IMPACT_SEVERITIES) .setSince("10.2") .setDescription("Comma-separated list of Software Quality Severities") - .setExampleValue(org.sonar.api.issue.impact.Severity.HIGH + "," + org.sonar.api.issue.impact.Severity.MEDIUM) - .setPossibleValues(org.sonar.api.issue.impact.Severity.values()); + .setExampleValue(HIGH + "," + MEDIUM) + .setPossibleValues(values()); action.createParam(PARAM_CLEAN_CODE_ATTRIBUTE_CATEGORIES) .setSince("10.2") .setDescription("Comma-separated list of Clean Code Attribute Categories") @@ -587,7 +595,7 @@ public class SearchAction implements IssuesWsAction { addMandatoryValuesToFacet(facets, PARAM_SEVERITIES, Severity.ALL); addMandatoryValuesToFacet(facets, PARAM_STATUSES, ISSUE_STATUSES); addMandatoryValuesToFacet(facets, PARAM_IMPACT_SOFTWARE_QUALITIES, enumToStringCollection(SoftwareQuality.values())); - addMandatoryValuesToFacet(facets, PARAM_IMPACT_SEVERITIES, enumToStringCollection(org.sonar.api.issue.impact.Severity.values())); + addMandatoryValuesToFacet(facets, PARAM_IMPACT_SEVERITIES, enumToStringCollection(values())); addMandatoryValuesToFacet(facets, PARAM_CLEAN_CODE_ATTRIBUTE_CATEGORIES, enumToStringCollection(CleanCodeAttributeCategory.values())); addMandatoryValuesToFacet(facets, PARAM_RESOLUTIONS, concat(singletonList(""), RESOLUTIONS)); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java index 081955fef7b..294a09b9b09 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java @@ -24,6 +24,7 @@ import com.google.common.io.Resources; import java.util.Collections; import java.util.Date; import java.util.List; +import org.sonar.api.issue.impact.Severity; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; @@ -39,6 +40,7 @@ import org.sonar.server.issue.IssueFieldsSetter; import org.sonar.server.issue.IssueFinder; import org.sonar.server.user.UserSession; +import static java.lang.String.format; import static org.sonar.core.issue.IssueChangeContext.issueChangeContextByUserBuilder; import static org.sonarqube.ws.client.issue.IssuesWsParameters.ACTION_SET_TAGS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ISSUE; @@ -57,7 +59,7 @@ public class SetTagsAction implements IssuesWsAction { private final OperationResponseWriter responseWriter; public SetTagsAction(UserSession userSession, DbClient dbClient, IssueFinder issueFinder, IssueFieldsSetter issueFieldsSetter, IssueUpdater issueUpdater, - OperationResponseWriter responseWriter) { + OperationResponseWriter responseWriter) { this.userSession = userSession; this.dbClient = dbClient; this.issueFinder = issueFinder; @@ -74,6 +76,7 @@ public class SetTagsAction implements IssuesWsAction { .setDescription("Set tags on an issue.
" + "Requires authentication and Browse permission on project") .setChangelog( + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added.", Severity.INFO.name(), Severity.BLOCKER.name())), new Change("10.4", "The response fields 'severity' and 'type' are deprecated. Please use 'impacts' instead."), new Change("10.4", "The response fields 'status' and 'resolution' are deprecated. Please use 'issueStatus' instead."), new Change("10.4", "Add 'issueStatus' field to the response."), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java index 919bd4a00ad..62ccecaa326 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ChangelogAction.java @@ -49,6 +49,8 @@ import org.sonar.db.rule.RuleImpactChangeDto; import org.sonar.db.user.UserDto; import static java.lang.String.format; +import static org.sonar.api.issue.impact.Severity.BLOCKER; +import static org.sonar.api.issue.impact.Severity.INFO; import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime; import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime; import static org.sonar.server.es.SearchOptions.MAX_PAGE_SIZE; @@ -84,7 +86,8 @@ public class ChangelogAction implements QProfileWsAction { new Change("10.3", "Added fields 'oldCleanCodeAttribute', 'newCleanCodeAttribute', 'oldCleanCodeAttributeCategory', " + "'newCleanCodeAttributeCategory' and 'impactChanges' to 'params' section of response"), new Change("10.3", "Added field 'sonarQubeVersion' to 'params' section of response"), - new Change("10.8", format("Added parameter '%s'", PARAM_FILTER_MODE))) + new Change("10.8", format("Added parameter '%s'", PARAM_FILTER_MODE)), + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added", INFO.name(), BLOCKER.name()))) .setHandler(this) .setResponseExample(getClass().getResource("changelog-example.json")); @@ -233,10 +236,8 @@ public class ChangelogAction implements QProfileWsAction { json .prop("oldCleanCodeAttribute", nameOrNull(ruleChange.getOldCleanCodeAttribute())) .prop("newCleanCodeAttribute", nameOrNull(ruleChange.getNewCleanCodeAttribute())) - .prop("oldCleanCodeAttributeCategory", ruleChange.getOldCleanCodeAttribute() == null ? null : - nameOrNull(ruleChange.getOldCleanCodeAttribute().getAttributeCategory())) - .prop("newCleanCodeAttributeCategory", ruleChange.getNewCleanCodeAttribute() == null ? null : - nameOrNull(ruleChange.getNewCleanCodeAttribute().getAttributeCategory())); + .prop("oldCleanCodeAttributeCategory", ruleChange.getOldCleanCodeAttribute() == null ? null : nameOrNull(ruleChange.getOldCleanCodeAttribute().getAttributeCategory())) + .prop("newCleanCodeAttributeCategory", ruleChange.getNewCleanCodeAttribute() == null ? null : nameOrNull(ruleChange.getNewCleanCodeAttribute().getAttributeCategory())); if (ruleChange.getRuleImpactChanges() != null) { json.name("impactChanges").beginArray(); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/CompareAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/CompareAction.java index 62491257a64..2ada11d9383 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/CompareAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/CompareAction.java @@ -51,6 +51,9 @@ import org.sonar.server.qualityprofile.QProfileComparison.ActiveRuleDiff; import org.sonar.server.qualityprofile.QProfileComparison.QProfileComparisonResult; import static com.google.common.base.Preconditions.checkArgument; +import static java.lang.String.format; +import static org.sonar.api.issue.impact.Severity.BLOCKER; +import static org.sonar.api.issue.impact.Severity.INFO; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02; @@ -100,7 +103,8 @@ public class CompareAction implements QProfileWsAction { new Change("10.3", String.format("Added '%s' and '%s' fields", ATTRIBUTE_CLEAN_CODE_ATTRIBUTE_CATEGORY, ATTRIBUTE_IMPACTS)), new Change("10.3", String.format("Dropped '%s' field from '%s', '%s' and '%s' objects", ATTRIBUTE_SEVERITY, ATTRIBUTE_SAME, ATTRIBUTE_IN_LEFT, ATTRIBUTE_IN_RIGHT)), - new Change("10.8", "'impacts' are part of the 'left' and 'right' sections of the 'modified' array")); + new Change("10.8", "'impacts' are part of the 'left' and 'right' sections of the 'modified' array"), + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added", INFO.name(), BLOCKER.name()))); compare.createParam(PARAM_LEFT_KEY) .setDescription("Profile key.") @@ -227,7 +231,6 @@ public class CompareAction implements QProfileWsAction { json.name(ATTRIBUTE_LEFT).beginObject(); json.prop(ATTRIBUTE_SEVERITY, value.leftSeverity()); - List leftImpacts = getLeftImpactDtos(value); json.name(ATTRIBUTE_IMPACTS); json.beginArray(); 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 a6712aaf1f4..de20a019288 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 @@ -56,8 +56,11 @@ import org.sonar.server.rule.ws.RulesResponseFormatter.SearchResult; import org.sonarqube.ws.Common; import org.sonarqube.ws.Rules; import org.sonarqube.ws.Rules.SearchResponse; +import org.sonarqube.ws.client.issue.IssuesWsParameters; import static java.lang.String.format; +import static org.sonar.api.issue.impact.Severity.BLOCKER; +import static org.sonar.api.issue.impact.Severity.INFO; import static org.sonar.api.server.ws.WebService.Param.ASCENDING; import static org.sonar.api.server.ws.WebService.Param.FACETS; import static org.sonar.api.server.ws.WebService.Param.FIELDS; @@ -141,6 +144,9 @@ public class SearchAction implements RulesWsAction { .addPagingParams(100, MAX_PAGE_SIZE) .setHandler(this) .setChangelog( + new Change("10.8", format("Possible values '%s' and '%s' for response field 'impactSeverities' of 'facets' have been added", INFO.name(), BLOCKER.name())), + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added", INFO.name(), BLOCKER.name())), + new Change("10.8", format("Parameter '%s' now supports values: '%s','%s'", IssuesWsParameters.PARAM_SEVERITIES, INFO.name(), BLOCKER.name())), new Change("10.6", format("Parameter '%s has been added", PARAM_PRIORITIZED_RULE)), new Change("5.5", "The field 'effortToFixDescription' has been deprecated, use 'gapDescription' instead"), new Change("5.5", "The field 'debtRemFnCoeff' has been deprecated, use 'remFnGapMultiplier' instead"), diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ShowAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ShowAction.java index 92bb42345f6..3ce3d1c7186 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ShowAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/ShowAction.java @@ -37,6 +37,8 @@ import org.sonarqube.ws.Rules.ShowResponse; import static java.lang.String.format; import static java.util.Collections.singletonList; import static java.util.Optional.ofNullable; +import static org.sonar.api.issue.impact.Severity.BLOCKER; +import static org.sonar.api.issue.impact.Severity.INFO; import static org.sonar.server.ws.WsUtils.writeProtobuf; /** @@ -84,7 +86,10 @@ public class ShowAction implements RulesWsAction { new Change("10.0", "The field 'defaultDebtRemFnType' has been deprecated, use 'defaultRemFnType' instead"), new Change("10.0", "The field 'debtRemFnType' has been deprecated, use 'remFnType' instead"), new Change("10.2", "Add 'impacts', 'cleanCodeAttribute', 'cleanCodeAttributeCategory' fields to the response"), - new Change("10.2", "The field 'severity' and 'type' in the response have been deprecated, use 'impacts' instead.")); + new Change("10.2", "The field 'severity' and 'type' in the response have been deprecated, use 'impacts' instead."), + new Change("10.8", format("Possible values '%s' and '%s' for response field 'severity' of 'impacts' have been added.", INFO.name(), BLOCKER.name())) + + ); action .createParam(PARAM_KEY) -- 2.39.5