From dd791e68ca7a5b0375e7cba70a2f8f27d4c75c26 Mon Sep 17 00:00:00 2001 From: Dimitris Kavvathas Date: Thu, 9 Mar 2023 17:19:37 +0100 Subject: [PATCH] SONAR-18638 Drop deprecated fields in Rules WS API. Drop "effortToFixDescription" and replace with "gapDescription". Drop "debtRemFnCoeff" and replace with "remFnGapMultiplier". Drop "defaultDebtRemFnCoeff" and replace with "defaultRemFnGapMultiplier". Drop "debtRemFnOffset" and replace with "remFnBaseEffort". Drop "defaultDebtRemFnOffset" and replace with "defaultRemFnBaseEffort". Correct the version when the field 'scope' was added. Drop "debtOverloaded" and replace with "remFnOverloaded". Deprecate "defaultDebtRemFnType" and "debtRemFnType" and replace with "defaultRemFnType" and "remFnType" accordingly. Deprecate "defaultDebtRemFn" and "debtRemFn" and replace with "defaultRemFn" and "remFn" accordingly. --- .../org/sonar/server/rule/RegisterRules.java | 8 +- .../main/java/org/sonar/server/rule/Rule.java | 110 ------------------ .../org/sonar/server/rule/ws/RuleMapper.java | 20 +--- .../server/rule/ws/RulesWsParameters.java | 30 +++-- .../sonar/server/rule/ws/SearchAction.java | 28 +++-- .../org/sonar/server/rule/ws/ShowAction.java | 30 +++-- .../sonar/server/rule/ws/update-example.json | 1 - .../server/rule/ws/SearchActionTest.java | 40 +++---- .../sonar/server/rule/ws/ShowActionTest.java | 12 +- .../filter_by_tags.json | 31 ----- .../get_note_as_markdown_and_html.json | 16 --- ...tory_fields_even_when_setting_f_param.json | 9 -- .../search_2_rules.json | 58 --------- .../search_2_rules_fields.json | 25 ---- .../search_active_rules.json | 14 --- .../search_active_rules_params.json | 20 ---- ...th_default_and_overridden_debt_values.json | 21 ---- ...r_offset_and_overridden_constant_debt.json | 21 ---- ...ear_offset_and_overridden_linear_debt.json | 20 ---- .../search_no_rules.json | 13 --- .../search_profile_active_rules.json | 40 ------- ...arch_profile_active_rules_inheritance.json | 33 ------ .../search_rules_from_template_key.json | 8 -- .../search_rules_with_deprecated_fields.json | 25 ---- .../search_template_rules.json | 8 -- .../severities_facet.json | 25 ---- .../statuses_facet.json | 18 --- .../statuses_facet_sticky.json | 20 ---- .../deprecated_remediation_function.json | 19 --- .../update_custom_rule.json | 26 ----- .../ws/client/rules/SearchRequest.java | 2 - sonar-ws/src/main/protobuf/ws-rules.proto | 26 ++--- 32 files changed, 96 insertions(+), 681 deletions(-) delete mode 100644 server/sonar-webserver-core/src/main/java/org/sonar/server/rule/Rule.java delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/filter_by_tags.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/return_mandatory_fields_even_when_setting_f_param.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules_params.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_and_overridden_debt_values.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_constant_debt.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_linear_debt.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_no_rules.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules_inheritance.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_from_template_key.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_with_deprecated_fields.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_template_rules.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/severities_facet.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet_sticky.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/deprecated_remediation_function.json delete mode 100644 server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/update_custom_rule.json diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java index 2ef6a85b902..6dfc0e417fa 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java @@ -547,7 +547,7 @@ public class RegisterRules implements Startable { } private static boolean mergeDebtDefinitions(RuleDto dto, @Nullable String remediationFunction, - @Nullable String remediationCoefficient, @Nullable String remediationOffset, @Nullable String effortToFixDescription) { + @Nullable String remediationCoefficient, @Nullable String remediationOffset, @Nullable String gapDescription) { boolean changed = false; if (!Objects.equals(dto.getDefRemediationFunction(), remediationFunction)) { @@ -562,8 +562,8 @@ public class RegisterRules implements Startable { dto.setDefRemediationBaseEffort(remediationOffset); changed = true; } - if (!Objects.equals(dto.getGapDescription(), effortToFixDescription)) { - dto.setGapDescription(effortToFixDescription); + if (!Objects.equals(dto.getGapDescription(), gapDescription)) { + dto.setGapDescription(gapDescription); changed = true; } return changed; @@ -809,7 +809,7 @@ public class RegisterRules implements Startable { return changes; } - private Set getExistingAndRenamedRepositories(RegisterRulesContext recorder, Collection context) { + private static Set getExistingAndRenamedRepositories(RegisterRulesContext recorder, Collection context) { return Stream.concat( context.stream().map(RulesDefinition.ExtendedRepository::key), recorder.getRenamed().map(Map.Entry::getValue).map(RuleKey::repository)) diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/Rule.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/Rule.java deleted file mode 100644 index 8cdb0d1f5be..00000000000 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/Rule.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.rule; - -import org.sonar.api.rule.RuleKey; -import org.sonar.api.rule.RuleStatus; -import org.sonar.api.server.debt.DebtRemediationFunction; - -import javax.annotation.CheckForNull; - -import java.util.Date; -import java.util.List; - -/** - * @since 4.4 - */ -public interface Rule { - - RuleKey key(); - - String language(); - - String name(); - - @CheckForNull - String htmlDescription(); - - @CheckForNull - String markdownDescription(); - - String effortToFixDescription(); - - /** - * Default severity when activated on a Quality profile - * - * @see org.sonar.api.rule.Severity - */ - String severity(); - - /** - * @see org.sonar.api.rule.RuleStatus - */ - RuleStatus status(); - - boolean isTemplate(); - - @CheckForNull - RuleKey templateKey(); - - /** - * Tags that can be customized by administrators - */ - List tags(); - - /** - * Read-only tags defined by plugins - */ - List systemTags(); - - List params(); - - @CheckForNull - RuleParam param(final String key); - - boolean debtOverloaded(); - - @CheckForNull - DebtRemediationFunction debtRemediationFunction(); - - @CheckForNull - DebtRemediationFunction defaultDebtRemediationFunction(); - - Date createdAt(); - - Date updatedAt(); - - @CheckForNull - String internalKey(); - - @CheckForNull - String markdownNote(); - - @CheckForNull - String noteLogin(); - - @CheckForNull - Date noteCreatedAt(); - - @CheckForNull - Date noteUpdatedAt(); - - boolean isManual(); -} diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java index efba2d80213..d4687572796 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleMapper.java @@ -53,14 +53,12 @@ import static org.sonar.api.utils.DateUtils.formatDateTime; import static org.sonar.core.util.stream.MoreCollectors.toList; import static org.sonar.db.rule.RuleDto.Format.MARKDOWN; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_CREATED_AT; -import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_DEBT_OVERLOADED; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_DEBT_REM_FUNCTION; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_DEFAULT_DEBT_REM_FUNCTION; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_DEFAULT_REM_FUNCTION; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_DEPRECATED_KEYS; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_DESCRIPTION_SECTIONS; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_EDUCATION_PRINCIPLES; -import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_EFFORT_TO_FIX_DESCRIPTION; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_GAP_DESCRIPTION; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_HTML_DESCRIPTION; import static org.sonar.server.rule.ws.RulesWsParameters.FIELD_INTERNAL_KEY; @@ -136,7 +134,7 @@ public class RuleMapper { setIsExternal(ruleResponse, ruleDto, fieldsToReturn); setTemplateKey(ruleResponse, ruleDto, result, fieldsToReturn); setDefaultDebtRemediationFunctionFields(ruleResponse, ruleDto, fieldsToReturn); - setEffortToFixDescription(ruleResponse, ruleDto, fieldsToReturn); + setGapDescription(ruleResponse, ruleDto, fieldsToReturn); setScope(ruleResponse, ruleDto, fieldsToReturn); setDeprecatedKeys(ruleResponse, ruleDto, fieldsToReturn, deprecatedRuleKeysByRuleUuid); @@ -235,18 +233,16 @@ public class RuleMapper { } } - private static void setEffortToFixDescription(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set fieldsToReturn) { + private static void setGapDescription(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set fieldsToReturn) { String gapDescription = ruleDto.getGapDescription(); - if ((shouldReturnField(fieldsToReturn, FIELD_EFFORT_TO_FIX_DESCRIPTION) || shouldReturnField(fieldsToReturn, FIELD_GAP_DESCRIPTION)) + if (shouldReturnField(fieldsToReturn, FIELD_GAP_DESCRIPTION) && gapDescription != null) { - ruleResponse.setEffortToFixDescription(gapDescription); ruleResponse.setGapDescription(gapDescription); } } private static void setIsRemediationFunctionOverloaded(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set fieldsToReturn) { - if (shouldReturnField(fieldsToReturn, FIELD_DEBT_OVERLOADED) || shouldReturnField(fieldsToReturn, FIELD_REM_FUNCTION_OVERLOADED)) { - ruleResponse.setDebtOverloaded(isRemediationFunctionOverloaded(ruleDto)); + if (shouldReturnField(fieldsToReturn, FIELD_REM_FUNCTION_OVERLOADED)) { ruleResponse.setRemFnOverloaded(isRemediationFunctionOverloaded(ruleDto)); } } @@ -258,14 +254,10 @@ public class RuleMapper { String gapMultiplier = defaultDebtRemediationFunction.gapMultiplier(); if (gapMultiplier != null) { ruleResponse.setDefaultRemFnGapMultiplier(gapMultiplier); - // Set deprecated field - ruleResponse.setDefaultDebtRemFnCoeff(gapMultiplier); } String baseEffort = defaultDebtRemediationFunction.baseEffort(); if (baseEffort != null) { ruleResponse.setDefaultRemFnBaseEffort(baseEffort); - // Set deprecated field - ruleResponse.setDefaultDebtRemFnOffset(baseEffort); } if (defaultDebtRemediationFunction.type() != null) { ruleResponse.setDefaultRemFnType(defaultDebtRemediationFunction.type().name()); @@ -289,14 +281,10 @@ public class RuleMapper { String gapMultiplier = debtRemediationFunction.gapMultiplier(); if (gapMultiplier != null) { ruleResponse.setRemFnGapMultiplier(gapMultiplier); - // Set deprecated field - ruleResponse.setDebtRemFnCoeff(gapMultiplier); } String baseEffort = debtRemediationFunction.baseEffort(); if (baseEffort != null) { ruleResponse.setRemFnBaseEffort(baseEffort); - // Set deprecated field - ruleResponse.setDebtRemFnOffset(baseEffort); } } } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RulesWsParameters.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RulesWsParameters.java index 0e8099ed6ba..a89544f995e 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RulesWsParameters.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RulesWsParameters.java @@ -68,31 +68,29 @@ public class RulesWsParameters { public static final String FIELD_HTML_NOTE = "htmlNote"; /** - * @deprecated since 5.5, replaced by {@link #FIELD_DEFAULT_REM_FUNCTION} + * Value for 'f' parameter which is used to return all the "defaultDebtRemFn" fields. + * + * @deprecated since 10.0, replaced by {@link #FIELD_DEFAULT_REM_FUNCTION} */ - @Deprecated + @Deprecated(since = "10.0") public static final String FIELD_DEFAULT_DEBT_REM_FUNCTION = "defaultDebtRemFn"; + /** + * Value for 'f' parameter which is used to return all the "defaultRemFn" fields. + */ public static final String FIELD_DEFAULT_REM_FUNCTION = "defaultRemFn"; /** - * @deprecated since 5.5, replaced by {@link #FIELD_REM_FUNCTION} + * Value for 'f' parameter which is used to return all the "debtRemFn" fields. + * + * @deprecated since 10.0, replaced by {@link #FIELD_REM_FUNCTION} */ - @Deprecated + @Deprecated(since = "10.0") public static final String FIELD_DEBT_REM_FUNCTION = "debtRemFn"; - public static final String FIELD_REM_FUNCTION = "remFn"; - /** - * @deprecated since 5.5, replaced by {@link #FIELD_GAP_DESCRIPTION} + * Value for 'f' parameter which is used to return all the "remFn" fields. */ - @Deprecated - public static final String FIELD_EFFORT_TO_FIX_DESCRIPTION = "effortToFixDescription"; + public static final String FIELD_REM_FUNCTION = "remFn"; public static final String FIELD_GAP_DESCRIPTION = "gapDescription"; - - /** - * @deprecated since 5.5, replaced by {@link #FIELD_REM_FUNCTION_OVERLOADED} - */ - @Deprecated - public static final String FIELD_DEBT_OVERLOADED = "debtOverloaded"; public static final String FIELD_REM_FUNCTION_OVERLOADED = "remFnOverloaded"; /** @@ -108,7 +106,7 @@ public class RulesWsParameters { public static final Set OPTIONAL_FIELDS = Set.of(FIELD_REPO, FIELD_NAME, FIELD_CREATED_AT, FIELD_UPDATED_AT, FIELD_SEVERITY, FIELD_STATUS, FIELD_INTERNAL_KEY, FIELD_IS_EXTERNAL, FIELD_IS_TEMPLATE, FIELD_TEMPLATE_KEY, FIELD_TAGS, FIELD_SYSTEM_TAGS, FIELD_LANGUAGE, FIELD_LANGUAGE_NAME, FIELD_HTML_DESCRIPTION, FIELD_MARKDOWN_DESCRIPTION, FIELD_DESCRIPTION_SECTIONS, FIELD_NOTE_LOGIN, FIELD_MARKDOWN_NOTE, FIELD_HTML_NOTE, - FIELD_DEFAULT_DEBT_REM_FUNCTION, FIELD_EFFORT_TO_FIX_DESCRIPTION, FIELD_DEBT_OVERLOADED, FIELD_DEBT_REM_FUNCTION, + FIELD_DEFAULT_DEBT_REM_FUNCTION, FIELD_DEBT_REM_FUNCTION, FIELD_DEFAULT_REM_FUNCTION, FIELD_GAP_DESCRIPTION, FIELD_REM_FUNCTION_OVERLOADED, FIELD_REM_FUNCTION, FIELD_PARAMS, FIELD_ACTIVES, FIELD_SCOPE, FIELD_DEPRECATED_KEYS, FIELD_EDUCATION_PRINCIPLES); 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 bfcbd6632ac..69ba17ff1cb 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 @@ -20,7 +20,6 @@ package org.sonar.server.rule.ws; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -99,7 +98,7 @@ import static org.sonar.server.ws.WsUtils.writeProtobuf; public class SearchAction implements RulesWsAction { public static final String ACTION = "search"; - private static final Collection DEFAULT_FACETS = ImmutableSet.of(PARAM_LANGUAGES, PARAM_REPOSITORIES, "tags"); + private static final Collection DEFAULT_FACETS = Set.of(PARAM_LANGUAGES, PARAM_REPOSITORIES, "tags"); private static final String[] POSSIBLE_FACETS = new String[]{ FACET_LANGUAGES, FACET_REPOSITORIES, @@ -140,21 +139,32 @@ public class SearchAction implements RulesWsAction { .setChangelog( new Change("9.8", "response fields 'total', 's', 'ps' have been deprecated, please use 'paging' object instead"), new Change("9.8", "The field 'paging' has been added to the response"), - 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"), - new Change("5.5", "The field 'defaultDebtRemFnCoeff' has been deprecated use 'defaultRemFnGapMultiplier' instead"), - new Change("5.5", "The field 'debtRemFnOffset' has been deprecated use 'remFnBaseEffort' instead"), - new Change("5.5", "The field 'defaultDebtRemFnOffset' has been deprecated use 'defaultRemFnBaseEffort' instead"), + 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"), + new Change("5.5", "The field 'defaultDebtRemFnCoeff' has been deprecated, use 'defaultRemFnGapMultiplier' instead"), + new Change("5.5", "The field 'debtRemFnOffset' has been deprecated, use 'remFnBaseEffort' instead"), + new Change("5.5", "The field 'defaultDebtRemFnOffset' has been deprecated, use 'defaultRemFnBaseEffort' instead"), + new Change("5.5", "The field 'debtOverloaded' has been deprecated, use 'remFnOverloaded' instead"), new Change("7.1", "The field 'scope' has been added to the response"), new Change("7.1", "The field 'scope' has been added to the 'f' parameter"), new Change("7.2", "The field 'isExternal' has been added to the response"), new Change("7.2", "The field 'includeExternal' has been added to the 'f' parameter"), new Change("7.5", "The field 'updatedAt' has been added to the 'f' parameter"), - new Change("9.5", "The field 'htmlDesc' has been deprecated use 'descriptionSections' instead"), + new Change("9.5", "The field 'htmlDesc' has been deprecated, use 'descriptionSections' instead"), new Change("9.5", "The field 'descriptionSections' has been added to the payload"), new Change("9.5", "The field 'descriptionSections' has been added to the 'f' parameter"), new Change("9.6", "'descriptionSections' can optionally embed a context field"), - new Change("9.6", "The field 'educationPrinciples' has been added to the 'f' parameter") + new Change("9.6", "The field 'educationPrinciples' has been added to the 'f' parameter"), + new Change("10.0", "The deprecated field 'effortToFixDescription' has been removed, use 'gapDescription' instead."), + new Change("10.0", "The deprecated field 'debtRemFnCoeff' has been removed, use 'remFnGapMultiplier' instead."), + new Change("10.0", "The deprecated field 'defaultDebtRemFnCoeff' has been removed, use 'defaultRemFnGapMultiplier' instead."), + new Change("10.0", "The deprecated field 'debtRemFnOffset' has been removed, use 'remFnBaseEffort' instead."), + new Change("10.0", "The deprecated field 'defaultDebtRemFnOffset' has been removed, use 'defaultRemFnBaseEffort' instead."), + new Change("10.0", "The deprecated field 'debtOverloaded' has been removed, use 'remFnOverloaded' instead."), + 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.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") ); action.createParam(FACETS) 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 ec77ecaa08e..32d3a5c62da 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 @@ -69,17 +69,25 @@ public class ShowAction implements RulesWsAction { .setResponseExample(Resources.getResource(getClass(), "show-example.json")) .setHandler(this) .setChangelog( - 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"), - new Change("5.5", "The field 'defaultDebtRemFnCoeff' has been deprecated use 'defaultRemFnGapMultiplier' instead"), - new Change("5.5", "The field 'debtRemFnOffset' has been deprecated use 'remFnBaseEffort' instead"), - new Change("5.5", "The field 'defaultDebtRemFnOffset' has been deprecated use 'defaultRemFnBaseEffort' instead"), - new Change("5.5", "The field 'debtOverloaded' has been deprecated use 'remFnOverloaded' instead"), - new Change("7.5", "The field 'scope' has been added"), - new Change("9.5", "The field 'htmlDesc' has been deprecated use 'descriptionSections' instead"), - new Change("9.5", "The field 'descriptionSections' has been added to the payload"), - new Change("9.6", "'descriptionSections' can optionally embed a context field"), - new Change("9.6", "'educationPrinciples' has been added") + new Change("5.5", "The field 'effortToFixDescription' in the response has been deprecated, it becomes 'gapDescription'."), + new Change("5.5", "The field 'debtRemFnCoeff' in the response has been deprecated, it becomes 'remFnGapMultiplier'."), + new Change("5.5", "The field 'defaultDebtRemFnCoeff' in the response has been deprecated, it becomes 'defaultRemFnGapMultiplier'."), + new Change("5.5", "The field 'debtRemFnOffset' in the response has been deprecated, it becomes 'remFnBaseEffort'."), + new Change("5.5", "The field 'defaultDebtRemFnOffset' in the response has been deprecated, it becomes 'defaultRemFnBaseEffort'."), + new Change("5.5", "The field 'debtOverloaded' in the response has been deprecated, it becomes 'remFnOverloaded'."), + new Change("7.1", "The field 'scope' has been added."), + new Change("9.5", "The field 'htmlDesc' in the response has been deprecated, it becomes 'descriptionSections'."), + new Change("9.5", "The field 'descriptionSections' has been added to the payload."), + new Change("9.6", "'descriptionSections' can optionally embed a context field."), + new Change("9.6", "'educationPrinciples' has been added."), + new Change("10.0", "The deprecated field 'effortToFixDescription' has been removed, use 'gapDescription' instead."), + new Change("10.0", "The deprecated field 'debtRemFnCoeff' has been removed, use 'remFnGapMultiplier' instead."), + new Change("10.0", "The deprecated field 'defaultDebtRemFnCoeff' has been removed, use 'defaultRemFnGapMultiplier' instead."), + new Change("10.0", "The deprecated field 'debtRemFnOffset' has been removed, use 'remFnBaseEffort' instead."), + new Change("10.0", "The deprecated field 'defaultDebtRemFnOffset' has been removed, use 'defaultRemFnBaseEffort' instead."), + new Change("10.0", "The deprecated field 'debtOverloaded' has been removed, use 'remFnOverloaded' instead."), + 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") ); action diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/update-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/update-example.json index 1b8d109ce6e..667cac2768e 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/update-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/update-example.json @@ -21,7 +21,6 @@ "defaultValue":"**/Sonar*","type":"STRING" } ], - "debtOverloaded":false, "remFnOverloaded":false, "scope":"MAIN", "isExternal":false, diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/SearchActionTest.java index dd5cfece4ff..a358b2efa2a 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/SearchActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/SearchActionTest.java @@ -312,7 +312,7 @@ public class SearchActionTest { Rules.SearchResponse response = ws.newRequest().executeProtobuf(Rules.SearchResponse.class); Rules.Rule result = response.getRules(0); assertThat(result.getCreatedAt()).isNotEmpty(); - assertThat(result.getEffortToFixDescription()).isNotEmpty(); + assertThat(result.getGapDescription()).isNotEmpty(); assertThat(result.getHtmlDesc()).isNotEmpty(); assertThat(result.hasIsTemplate()).isTrue(); assertThat(result.getLang()).isEqualTo(rule.getLanguage()); @@ -343,7 +343,7 @@ public class SearchActionTest { assertThat(result.getEducationPrinciples().getEducationPrinciplesList()).containsExactlyElementsOf(rule.getEducationPrinciples()); // not returned fields - assertThat(result.hasEffortToFixDescription()).isFalse(); + assertThat(result.hasGapDescription()).isFalse(); assertThat(result.hasHtmlDesc()).isFalse(); assertThat(result.hasIsTemplate()).isFalse(); assertThat(result.hasLang()).isFalse(); @@ -566,7 +566,7 @@ public class SearchActionTest { indexRules(); SearchResponse result = ws.newRequest() - .setParam("f", "debtRemFn,debtOverloaded,defaultDebtRemFn") + .setParam("f", "debtRemFn,remFnOverloaded,defaultDebtRemFn") .executeProtobuf(SearchResponse.class); assertThat(result.getTotal()).isOne(); assertThat(result.getPaging().getTotal()).isOne(); @@ -575,15 +575,15 @@ public class SearchActionTest { Rule searchedRule = result.getRules(0); assertThat(searchedRule).isNotNull(); - assertThat(searchedRule.getDefaultDebtRemFnCoeff()).isEqualTo("1h"); - assertThat(searchedRule.getDefaultDebtRemFnOffset()).isEqualTo("15min"); + assertThat(searchedRule.getDefaultRemFnGapMultiplier()).isEqualTo("1h"); + assertThat(searchedRule.getDefaultRemFnBaseEffort()).isEqualTo("15min"); assertThat(searchedRule.getDefaultDebtRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name()); assertThat(searchedRule.getDefaultRemFnBaseEffort()).isEqualTo("15min"); assertThat(searchedRule.getDefaultRemFnGapMultiplier()).isEqualTo("1h"); assertThat(searchedRule.getDefaultRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name()); - assertThat(searchedRule.getDebtOverloaded()).isTrue(); - assertThat(searchedRule.getDebtRemFnCoeff()).isEqualTo("2h"); - assertThat(searchedRule.getDebtRemFnOffset()).isEqualTo("25min"); + assertThat(searchedRule.getRemFnOverloaded()).isTrue(); + assertThat(searchedRule.getRemFnGapMultiplier()).isEqualTo("2h"); + assertThat(searchedRule.getRemFnBaseEffort()).isEqualTo("25min"); assertThat(searchedRule.getDebtRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name()); } @@ -600,7 +600,7 @@ public class SearchActionTest { indexRules(); SearchResponse result = ws.newRequest() - .setParam("f", "debtRemFn,debtOverloaded,defaultDebtRemFn") + .setParam("f", "debtRemFn,remFnOverloaded,defaultDebtRemFn") .executeProtobuf(SearchResponse.class); assertThat(result.getTotal()).isOne(); assertThat(result.getPaging().getTotal()).isOne(); @@ -609,15 +609,15 @@ public class SearchActionTest { Rule searchedRule = result.getRules(0); assertThat(searchedRule).isNotNull(); - assertThat(searchedRule.getDefaultDebtRemFnCoeff()).isEqualTo("1h"); - assertThat(searchedRule.getDefaultDebtRemFnOffset()).isEqualTo("15min"); + assertThat(searchedRule.getDefaultRemFnGapMultiplier()).isEqualTo("1h"); + assertThat(searchedRule.getDefaultRemFnBaseEffort()).isEqualTo("15min"); assertThat(searchedRule.getDefaultDebtRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name()); assertThat(searchedRule.getDefaultRemFnBaseEffort()).isEqualTo("15min"); assertThat(searchedRule.getDefaultRemFnGapMultiplier()).isEqualTo("1h"); assertThat(searchedRule.getDefaultRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name()); - assertThat(searchedRule.getDebtOverloaded()).isTrue(); - assertThat(searchedRule.getDebtRemFnCoeff()).isEmpty(); - assertThat(searchedRule.getDebtRemFnOffset()).isEqualTo("5min"); + assertThat(searchedRule.getRemFnOverloaded()).isTrue(); + assertThat(searchedRule.getRemFnGapMultiplier()).isEmpty(); + assertThat(searchedRule.getRemFnBaseEffort()).isEqualTo("5min"); assertThat(searchedRule.getDebtRemFnType()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE.name()); } @@ -634,7 +634,7 @@ public class SearchActionTest { indexRules(); SearchResponse result = ws.newRequest() - .setParam("f", "debtRemFn,debtOverloaded,defaultDebtRemFn") + .setParam("f", "debtRemFn,remFnOverloaded,defaultDebtRemFn") .executeProtobuf(SearchResponse.class); assertThat(result.getTotal()).isOne(); assertThat(result.getPaging().getTotal()).isOne(); @@ -643,15 +643,15 @@ public class SearchActionTest { Rule searchedRule = result.getRules(0); assertThat(searchedRule).isNotNull(); - assertThat(searchedRule.getDefaultDebtRemFnCoeff()).isEqualTo("1h"); - assertThat(searchedRule.getDefaultDebtRemFnOffset()).isEqualTo("15min"); + assertThat(searchedRule.getDefaultRemFnGapMultiplier()).isEqualTo("1h"); + assertThat(searchedRule.getDefaultRemFnBaseEffort()).isEqualTo("15min"); assertThat(searchedRule.getDefaultDebtRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name()); assertThat(searchedRule.getDefaultRemFnBaseEffort()).isEqualTo("15min"); assertThat(searchedRule.getDefaultRemFnGapMultiplier()).isEqualTo("1h"); assertThat(searchedRule.getDefaultRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name()); - assertThat(searchedRule.getDebtOverloaded()).isTrue(); - assertThat(searchedRule.getDebtRemFnCoeff()).isEqualTo("1h"); - assertThat(searchedRule.getDebtRemFnOffset()).isEmpty(); + assertThat(searchedRule.getRemFnOverloaded()).isTrue(); + assertThat(searchedRule.getRemFnGapMultiplier()).isEqualTo("1h"); + assertThat(searchedRule.getRemFnBaseEffort()).isEmpty(); assertThat(searchedRule.getDebtRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name()); } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/ShowActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/ShowActionTest.java index a955a8541fa..70e917819b5 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/ShowActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/ShowActionTest.java @@ -287,13 +287,13 @@ public class ShowActionTest { Rule resultRule = result.getRule(); assertThat(resultRule.getDefaultRemFnType()).isEqualTo("LINEAR_OFFSET"); - assertThat(resultRule.getDefaultDebtRemFnCoeff()).isEqualTo("5d"); - assertThat(resultRule.getDefaultDebtRemFnOffset()).isEqualTo("10h"); - assertThat(resultRule.getEffortToFixDescription()).isEqualTo("gap desc"); + assertThat(resultRule.getDefaultRemFnGapMultiplier()).isEqualTo("5d"); + assertThat(resultRule.getDefaultRemFnBaseEffort()).isEqualTo("10h"); + assertThat(resultRule.getGapDescription()).isEqualTo("gap desc"); assertThat(resultRule.getDebtRemFnType()).isEqualTo("CONSTANT_ISSUE"); - assertThat(resultRule.hasDebtRemFnCoeff()).isFalse(); - assertThat(resultRule.getDebtRemFnOffset()).isEqualTo("15h"); - assertThat(resultRule.getDebtOverloaded()).isTrue(); + assertThat(resultRule.hasRemFnGapMultiplier()).isFalse(); + assertThat(resultRule.getRemFnBaseEffort()).isEqualTo("15h"); + assertThat(resultRule.getRemFnOverloaded()).isTrue(); assertThat(resultRule.hasDeprecatedKeys()).isFalse(); } diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/filter_by_tags.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/filter_by_tags.json deleted file mode 100644 index 20697e5b8ec..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/filter_by_tags.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 1 - }, - "rules": [ - { - "key": "xoo:x1", - "sysTags": ["tag1"], - "tags": [] - } - ], - "facets": [ - { - "property": "tags", - "values": [ - { - "val": "tag1", - "count": 1 - }, - { - "val": "tag2", - "count": 1 - } - ] - } -]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json deleted file mode 100644 index fcee129b4b1..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 1 - }, - "rules": [ - { - "key": "xoo:x1", - "htmlNote": "this is bold", - "mdNote": "this is *bold*" - } - ]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/return_mandatory_fields_even_when_setting_f_param.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/return_mandatory_fields_even_when_setting_f_param.json deleted file mode 100644 index f3a9823c7ba..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/return_mandatory_fields_even_when_setting_f_param.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "rules": [ - { - "key": "xoo:x1", - "name": "Rule x1", - "type": "CODE_SMELL" - } - ] -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules.json deleted file mode 100644 index cd8c7024d55..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "total": 2, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 2 - }, - "rules": [ - { - "key": "xoo:x2", - "repo": "xoo", - "name": "Rule x2", - "htmlDesc": "Description x2", - "severity": "INFO", - "status": "READY", - "internalKey": "InternalKeyx2", - "isTemplate": false, - "tags": [ - "tag1", - "tag2" - ], - "sysTags": [ - "systag1", - "systag2" - ], - "debtRemFnType": "LINEAR", - "debtRemFnCoeff": "1h", - "lang": "xoo", - "type": "VULNERABILITY", - "params": [] - }, - { - "key": "xoo:x1", - "repo": "xoo", - "name": "Rule x1", - "htmlDesc": "Description x1", - "severity": "INFO", - "status": "READY", - "internalKey": "InternalKeyx1", - "isTemplate": false, - "tags": [ - "tag1", - "tag2" - ], - "sysTags": [ - "systag1", - "systag2" - ], - "debtRemFnType": "LINEAR", - "debtRemFnCoeff": "1h", - "lang": "xoo", - "type": "BUG", - "params": [] - } - ] -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json deleted file mode 100644 index 404203e522f..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "total": 2, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 2 - }, - "rules": [ - { - "key": "xoo:x2", - "name": "Rule x2", - "mdDesc": "A *Xoo* rule", - "htmlDesc": "A Xoo rule", - "type": "BUG" - }, - { - "key": "xoo:x1", - "name": "Rule x1", - "htmlDesc": "Description x1", - "type": "CODE_SMELL" - } - ] -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules.json deleted file mode 100644 index fdc460c739d..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 2 - }, - "rules": [ - { - "key": "xoo:x1" - } - ]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules_params.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules_params.json deleted file mode 100644 index c8edf1ad34a..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_active_rules_params.json +++ /dev/null @@ -1,20 +0,0 @@ -{"total": 1, "p": 1, "ps": 100, "rules": [ - { - "key": "xoo:x1", - "params": [ - { - "key": "my_var", - "htmlDesc": "My small description", - "defaultValue": "some value", - "type": "string" - }, - { - "key": "the_var", - "htmlDesc": "My small description", - "defaultValue": "other value", - "type": "integer" - } - ] - } -] -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_and_overridden_debt_values.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_and_overridden_debt_values.json deleted file mode 100644 index 2fce4c1f7be..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_and_overridden_debt_values.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 1 - }, - "rules": [ - { - "key": "xoo:x1", - "remFnType": "LINEAR_OFFSET", - "remFnGapMultiplier": "2h", - "remFnBaseEffort": "25min", - "debtOverloaded": true, - "defaultRemFnType": "LINEAR_OFFSET", - "defaultRemFnGapMultiplier": "1h", - "defaultRemFnBaseEffort": "15min" - } -]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_constant_debt.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_constant_debt.json deleted file mode 100644 index 435010e807c..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_constant_debt.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 1 - }, - "rules": [ - { - "key": "xoo:x1", - "remFnType": "CONSTANT_ISSUE", - "remFnBaseEffort": "5min", - "debtOverloaded": true, - "defaultRemFnType": "LINEAR_OFFSET", - "defaultRemFnGapMultiplier": "1h", - "defaultRemFnBaseEffort": "15min" - } - ] -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_linear_debt.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_linear_debt.json deleted file mode 100644 index 684826ba2a4..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_debt_rules_with_default_linear_offset_and_overridden_linear_debt.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 1 - }, - "rules": [ - { - "key": "xoo:x1", - "remFnType": "LINEAR", - "remFnGapMultiplier": "1h", - "debtOverloaded": true, - "defaultRemFnType": "LINEAR_OFFSET", - "defaultRemFnGapMultiplier": "1h", - "defaultRemFnBaseEffort": "15min" - } -]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_no_rules.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_no_rules.json deleted file mode 100644 index f62d3435336..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_no_rules.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "total": 0, - "p": 1, - "ps": 100, - "paging": { - "pageIndex": 1, - "pageSize": 100, - "total": 99999 - }, - "rules": [], - "actives": {}, - "qProfiles": {} -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules.json deleted file mode 100644 index 293af7e0604..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "rules": [ - { - "key": "xoo:x1" - } - ], - "actives": { - "xoo:x1": [ - { - "qProfile": "XOO_P2", - "inherit": "NONE", - "severity": "BLOCKER", - "params": [ - { - "key": "the_var", - "value": "The Other Value" - }, - { - "key": "my_var", - "value": "The VALUE" - }, - { - "key": "empty_var", - "value": "" - } - ] - } - ] - }, - "qProfiles": { - "XOO_P2": { - "name": "P2", - "lang": "xoo", - "langName": "Xoo" - } - } -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules_inheritance.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules_inheritance.json deleted file mode 100644 index 016101f2a44..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_profile_active_rules_inheritance.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "total": 1, - "p": 1, - "ps": 100, - "rules": [ - { - "key": "xoo:x1" - } - ], - "actives": { - "xoo:x1": [ - { - "qProfile": "XOO_P2", - "inherit": "OVERRIDES", - "severity": "CRITICAL", - "params": [] - } - ] - }, - "qProfiles": { - "XOO_P2": { - "name": "P2", - "lang": "xoo", - "langName": "Xoo", - "parent": "XOO_P1" - }, - "XOO_P1": { - "name": "P1", - "lang": "xoo", - "langName": "Xoo" - } - } -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_from_template_key.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_from_template_key.json deleted file mode 100644 index f9668593f71..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_from_template_key.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "total": 1, "p": 1, "ps": 100, - "rules": [ - { - "key": "xoo:x2", - "templateKey": "xoo:x1" - } - ]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_with_deprecated_fields.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_with_deprecated_fields.json deleted file mode 100644 index 6bac1056119..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_rules_with_deprecated_fields.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "rules": [ - { - "key": "xoo:x1", - "name": "Rule x1", - "defaultDebtRemFnType": "LINEAR_OFFSET", - "defaultDebtRemFnCoeff": "1h", - "defaultDebtRemFnOffset": "15min", - "effortToFixDescription": "xoo.x1.effortToFix", - "debtOverloaded": true, - "debtRemFnType": "LINEAR_OFFSET", - "debtRemFnCoeff": "2h", - "debtRemFnOffset": "25min", - "defaultRemFnType": "LINEAR_OFFSET", - "defaultRemFnGapMultiplier": "1h", - "defaultRemFnBaseEffort": "15min", - "remFnType": "LINEAR_OFFSET", - "remFnGapMultiplier": "2h", - "remFnBaseEffort": "25min", - "remFnOverloaded": true, - "gapDescription": "xoo.x1.effortToFix", - "type": "CODE_SMELL" - } - ] -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_template_rules.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_template_rules.json deleted file mode 100644 index c7a449843da..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_template_rules.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "total": 1, "p": 1, "ps": 100, - "rules": [ - { - "key": "xoo:x1", - "isTemplate": true - } -]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/severities_facet.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/severities_facet.json deleted file mode 100644 index f2d9754809b..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/severities_facet.json +++ /dev/null @@ -1,25 +0,0 @@ -{"total": 0, "p": 1, "ps": 100, "rules": [], -"facets": [ - { - "property": "severities", - "values": [ - { - "val": "BLOCKER", - "count": 0 - },{ - "val": "CRITICAL", - "count": 0 - },{ - "val": "MAJOR", - "count": 0 - },{ - "val": "MINOR", - "count": 0 - }, - { - "val": "INFO", - "count": 0 - } - ] - } -]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet.json deleted file mode 100644 index 4692be87efe..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet.json +++ /dev/null @@ -1,18 +0,0 @@ -{"total": 0, "p": 1, "ps": 100, "rules": [], -"facets": [ - { - "property": "statuses", - "values": [ - { - "val": "BETA", - "count": 0 - },{ - "val": "DEPRECATED", - "count": 0 - },{ - "val": "READY", - "count": 0 - } - ] - } -]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet_sticky.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet_sticky.json deleted file mode 100644 index a5b7a796655..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/statuses_facet_sticky.json +++ /dev/null @@ -1,20 +0,0 @@ -{"total": 1, "p": 1, "ps": 100, "rules": [ - {"key": "xoo:x3"} -], -"facets": [ - { - "property": "statuses", - "values": [ - { - "val": "BETA", - "count": 1 - },{ - "val": "DEPRECATED", - "count": 1 - },{ - "val": "READY", - "count": 1 - } - ] - } -]} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/deprecated_remediation_function.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/deprecated_remediation_function.json deleted file mode 100644 index e5dcab52ace..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/deprecated_remediation_function.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "rule": { - "key": "xoo:x1", - "defaultDebtRemFnType": "LINEAR_OFFSET", - "defaultDebtRemFnCoeff": "10d", - "defaultDebtRemFnOffset": "5min", - "effortToFixDescription": "xoo.x1.effortToFix", - "debtRemFnType": "LINEAR_OFFSET", - "debtRemFnCoeff": "11d", - "debtRemFnOffset": "6min", - "defaultRemFnType": "LINEAR_OFFSET", - "defaultRemFnGapMultiplier": "10d", - "defaultRemFnBaseEffort": "5min", - "remFnType": "LINEAR_OFFSET", - "remFnGapMultiplier": "11d", - "remFnBaseEffort": "6min", - "gapDescription": "xoo.x1.effortToFix", - } -} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/update_custom_rule.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/update_custom_rule.json deleted file mode 100644 index 2e3f3fa36ef..00000000000 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/UpdateActionMediumTest/update_custom_rule.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "rule": { - "key": "java:MY_CUSTOM", - "repo": "java", - "name": "My custom rule", - "htmlDesc": "Description", - "severity": "MAJOR", - "status": "BETA", - "internalKey": "InternalKeyS001", - "isTemplate": false, - "templateKey": "java:S001", - "tags": ["tag1", "tag2"], - "sysTags": ["systag1", "systag2"], - "debtRemFnType": "LINEAR_OFFSET", - "debtRemFnCoeff": "5d", - "debtRemFnOffset": "10h", - "lang": "js", - "params": [ - { - "key": "regex", - "htmlDesc": "Reg ex", - "defaultValue": "a.*" - } - ] - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java index d42160d816a..068caa90a59 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java @@ -158,11 +158,9 @@ public class SearchRequest { *
    *
  • "actives"
  • *
  • "createdAt"
  • - *
  • "debtOverloaded"
  • *
  • "debtRemFn"
  • *
  • "defaultDebtRemFn"
  • *
  • "defaultRemFn"
  • - *
  • "effortToFixDescription"
  • *
  • "gapDescription"
  • *
  • "htmlDesc"
  • *
  • "htmlNote"
  • diff --git a/sonar-ws/src/main/protobuf/ws-rules.proto b/sonar-ws/src/main/protobuf/ws-rules.proto index 96c6fb64797..961cd327428 100644 --- a/sonar-ws/src/main/protobuf/ws-rules.proto +++ b/sonar-ws/src/main/protobuf/ws-rules.proto @@ -96,22 +96,16 @@ message Rule { optional string unusedDebtCharName = 27; optional string unusedDebtSubCharName = 28; - // Deprecated since 5.5, replaced by defaultRemFnType - optional string defaultDebtRemFnType = 29; - // Deprecated since 5.5, replaced by defaultRemFnGapMultiplier - optional string defaultDebtRemFnCoeff = 30; - // Deprecated since 5.5, replaced by defaultRemFnBaseEffort - optional string defaultDebtRemFnOffset = 31; - // Deprecated since 5.5, replaced by gapDescription - optional string effortToFixDescription = 32; - // Deprecated since 5.5, replaced by remFnOverloaded - optional bool debtOverloaded = 33; - // Deprecated since 5.5, replaced by remFnType - optional string debtRemFnType = 34; - // Deprecated since 5.5, replaced by remFnGapMultiplier - optional string debtRemFnCoeff = 35; - // Deprecated since 5.5, replaced by remFnBaseEffort - optional string debtRemFnOffset = 36; + // Deprecated since 10.0, replaced by defaultRemFnType + optional string defaultDebtRemFnType = 29 [deprecated=true]; + reserved 30; + reserved 31; + reserved 32; + reserved 33; + // Deprecated since 10.0, replaced by remFnType + optional string debtRemFnType = 34 [deprecated=true]; + reserved 35; + reserved 36; optional sonarqube.ws.commons.RuleType type = 37; optional string defaultRemFnType = 38; optional string defaultRemFnGapMultiplier = 39; -- 2.39.5