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.
}
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)) {
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;
return changes;
}
- private Set<String> getExistingAndRenamedRepositories(RegisterRulesContext recorder, Collection<RulesDefinition.Repository> context) {
+ private static Set<String> getExistingAndRenamedRepositories(RegisterRulesContext recorder, Collection<RulesDefinition.Repository> context) {
return Stream.concat(
context.stream().map(RulesDefinition.ExtendedRepository::key),
recorder.getRenamed().map(Map.Entry::getValue).map(RuleKey::repository))
+++ /dev/null
-/*
- * 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<String> tags();
-
- /**
- * Read-only tags defined by plugins
- */
- List<String> systemTags();
-
- List<RuleParam> 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();
-}
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;
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);
}
}
- private static void setEffortToFixDescription(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set<String> fieldsToReturn) {
+ private static void setGapDescription(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set<String> 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<String> 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));
}
}
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());
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);
}
}
}
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";
/**
public static final Set<String> 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);
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;
public class SearchAction implements RulesWsAction {
public static final String ACTION = "search";
- private static final Collection<String> DEFAULT_FACETS = ImmutableSet.of(PARAM_LANGUAGES, PARAM_REPOSITORIES, "tags");
+ private static final Collection<String> DEFAULT_FACETS = Set.of(PARAM_LANGUAGES, PARAM_REPOSITORIES, "tags");
private static final String[] POSSIBLE_FACETS = new String[]{
FACET_LANGUAGES,
FACET_REPOSITORIES,
.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)
.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
"defaultValue":"**/Sonar*","type":"STRING"
}
],
- "debtOverloaded":false,
"remFnOverloaded":false,
"scope":"MAIN",
"isExternal":false,
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());
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();
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();
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());
}
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();
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());
}
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();
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());
}
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();
}
+++ /dev/null
-{
- "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
- }
- ]
- }
-]}
+++ /dev/null
-{
- "total": 1,
- "p": 1,
- "ps": 100,
- "paging": {
- "pageIndex": 1,
- "pageSize": 100,
- "total": 1
- },
- "rules": [
- {
- "key": "xoo:x1",
- "htmlNote": "this is <strong>bold</strong>",
- "mdNote": "this is *bold*"
- }
- ]}
+++ /dev/null
-{
- "rules": [
- {
- "key": "xoo:x1",
- "name": "Rule x1",
- "type": "CODE_SMELL"
- }
- ]
-}
+++ /dev/null
-{
- "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": []
- }
- ]
-}
+++ /dev/null
-{
- "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 <strong>Xoo</strong> rule",
- "type": "BUG"
- },
- {
- "key": "xoo:x1",
- "name": "Rule x1",
- "htmlDesc": "Description x1",
- "type": "CODE_SMELL"
- }
- ]
-}
+++ /dev/null
-{
- "total": 1,
- "p": 1,
- "ps": 100,
- "paging": {
- "pageIndex": 1,
- "pageSize": 100,
- "total": 2
- },
- "rules": [
- {
- "key": "xoo:x1"
- }
- ]}
+++ /dev/null
-{"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"
- }
- ]
- }
-]
-}
+++ /dev/null
-{
- "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"
- }
-]}
+++ /dev/null
-{
- "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"
- }
- ]
-}
+++ /dev/null
-{
- "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"
- }
-]}
+++ /dev/null
-{
- "total": 0,
- "p": 1,
- "ps": 100,
- "paging": {
- "pageIndex": 1,
- "pageSize": 100,
- "total": 99999
- },
- "rules": [],
- "actives": {},
- "qProfiles": {}
-}
+++ /dev/null
-{
- "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"
- }
- }
-}
+++ /dev/null
-{
- "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"
- }
- }
-}
+++ /dev/null
-{
- "total": 1, "p": 1, "ps": 100,
- "rules": [
- {
- "key": "xoo:x2",
- "templateKey": "xoo:x1"
- }
- ]}
+++ /dev/null
-{
- "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"
- }
- ]
-}
+++ /dev/null
-{
- "total": 1, "p": 1, "ps": 100,
- "rules": [
- {
- "key": "xoo:x1",
- "isTemplate": true
- }
-]}
+++ /dev/null
-{"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
- }
- ]
- }
-]}
+++ /dev/null
-{"total": 0, "p": 1, "ps": 100, "rules": [],
-"facets": [
- {
- "property": "statuses",
- "values": [
- {
- "val": "BETA",
- "count": 0
- },{
- "val": "DEPRECATED",
- "count": 0
- },{
- "val": "READY",
- "count": 0
- }
- ]
- }
-]}
+++ /dev/null
-{"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
- }
- ]
- }
-]}
+++ /dev/null
-{
- "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",
- }
-}
+++ /dev/null
-{
- "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.*"
- }
- ]
- }
-}
* <ul>
* <li>"actives"</li>
* <li>"createdAt"</li>
- * <li>"debtOverloaded"</li>
* <li>"debtRemFn"</li>
* <li>"defaultDebtRemFn"</li>
* <li>"defaultRemFn"</li>
- * <li>"effortToFixDescription"</li>
* <li>"gapDescription"</li>
* <li>"htmlDesc"</li>
* <li>"htmlNote"</li>
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;