aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-03-08 21:47:03 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-03-10 15:20:55 +0100
commitb669aac1e3848a1e4c945c0ab09591a6171a8b5a (patch)
tree87d8a2b5f6e919047b3341deefd36b12c1f6f623 /sonar-plugin-api/src/main
parent66af03fd25ea718f34548e449f95d5601d2e9aa2 (diff)
downloadsonarqube-b669aac1e3848a1e4c945c0ab09591a6171a8b5a.tar.gz
sonarqube-b669aac1e3848a1e4c945c0ab09591a6171a8b5a.zip
SONAR-7453 Rename rules remediation function fields in API
Diffstat (limited to 'sonar-plugin-api/src/main')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java80
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java53
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java19
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java57
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java59
5 files changed, 177 insertions, 91 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java
index fa8feda469a..07912bd464a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java
@@ -23,7 +23,7 @@ import javax.annotation.CheckForNull;
/**
* Function used to calculate the remediation cost of an issue. See {@link Type} for details.
- * <p>The coefficient and offset involved in the functions are durations. They are defined in hours, minutes and/or
+ * <p>The gap multiplier and base effort involved in the functions are durations. They are defined in hours, minutes and/or
* seconds. Examples: "5min", "1h 10min". Supported units are "d" (days), "h" (hour), and "min" (minutes).</p>
*
* @since 4.3
@@ -35,23 +35,23 @@ public interface DebtRemediationFunction {
/**
* The cost to fix an issue of this type depends on the magnitude of the issue.
* For instance, an issue related to file size might be linear, with the total cost-to-fix incrementing
- * (by the coefficient amount) for each line of code above the allowed threshold.
- * The rule must provide the "effort to fix" value when raising an issue.
+ * (by the gap multiplier amount) for each line of code above the allowed threshold.
+ * The rule must provide the "gap" value when raising an issue.
*/
LINEAR(true, false),
/**
- * It takes a certain amount of time to deal with an issue of this type (this is the offset).
+ * It takes a certain amount of time to deal with an issue of this type (this is the gap multiplier).
* Then, the magnitude of the issue comes in to play. For instance, an issue related to complexity might be linear with offset.
- * So the total cost to fix is the time to make the basic analysis (the offset) plus the time required to deal
+ * So the total cost to fix is the time to make the basic analysis (the base effort) plus the time required to deal
* with each complexity point above the allowed value.
* <p>
- * <code>Total remediation cost = offset + (number of noncompliance x coefficient)</code>
+ * <code>Total remediation cost = base effort + (number of noncompliance x gap multiplier)</code>
* </p>
- * <p>The rule must provide the "effort to fix" value when raising an issue. Let’s take as a example the “Paragraphs should not be too complex” rule.
+ * <p>The rule must provide the "gap" value when raising an issue. Let’s take as a example the “Paragraphs should not be too complex” rule.
* If you set the rule threshold to 20, and you have a paragraph with a complexity of 27, you have 7 points of complexity
- * to remove. Internally, this is called the Effort to Fix. In that case, if you use the LINEAR_OFFSET configuration
- * with an offset of 4h and a remediation cost of 1mn, the technical debt for this issue related to a
+ * to remove. Internally, this is called the Gap. In that case, if you use the LINEAR_OFFSET configuration
+ * with an base effort of 4h and a remediation cost of 1mn, the effort for this issue related to a
* too-complex block of code will be: (7 complexity points x 1min) + 4h = 4h and 7mn
* </p>
*/
@@ -63,35 +63,79 @@ public interface DebtRemediationFunction {
*/
CONSTANT_ISSUE(false, true);
- private final boolean usesCoefficient;
- private final boolean usesOffset;
+ private final boolean usesGapMultiplier;
+ private final boolean usesBaseEffort;
- Type(boolean usesCoefficient, boolean usesOffset) {
- this.usesCoefficient = usesCoefficient;
- this.usesOffset = usesOffset;
+ Type(boolean usesGapMultiplier, boolean usesBaseEffort) {
+ this.usesGapMultiplier = usesGapMultiplier;
+ this.usesBaseEffort = usesBaseEffort;
}
+ /**
+ * @deprecated since 5.5, replaced by {@link #usesGapMultiplier()}
+ */
+ @Deprecated
public boolean usesCoefficient() {
- return usesCoefficient;
+ return usesGapMultiplier();
}
+ /**
+ * @since 5.5
+ */
+ public boolean usesGapMultiplier() {
+ return usesGapMultiplier;
+ }
+
+ /**
+ * @deprecated since 5.5, replaced by {@link #usesBaseEffort()}
+ */
+ @Deprecated
public boolean usesOffset() {
- return usesOffset;
+ return usesBaseEffort();
}
+
+ /**
+ * @since 5.5
+ */
+ public boolean usesBaseEffort() {
+ return usesBaseEffort;
+ }
+
}
+ /**
+ * @since 5.5
+ */
Type type();
/**
- * Non-null value on {@link Type#LINEAR} and {@link Type#LINEAR_OFFSET} functions, else {@code null}.
+ * @deprecated since 5.5, replaced by {@link #gapMultiplier()}
*/
+ @Deprecated
@CheckForNull
String coefficient();
/**
- * Non-null value on {@link Type#LINEAR_OFFSET} and {@link Type#CONSTANT_ISSUE} functions, else {@code null}.
+ * Non-null value on {@link Type#LINEAR} and {@link Type#LINEAR_OFFSET} functions, else {@code null}.
+ *
+ * @since 5.5
*/
@CheckForNull
+ String gapMultiplier();
+
+ /**
+ * @deprecated since 5.5, replaced by {@link #baseEffort()}
+ */
+ @Deprecated
+ @CheckForNull
String offset();
+ /**
+ * Non-null value on {@link Type#LINEAR_OFFSET} and {@link Type#CONSTANT_ISSUE} functions, else {@code null}.
+ *
+ * @since 5.5
+ */
+ @CheckForNull
+ String baseEffort();
+
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
index dad2e2fdfb2..824a7fac706 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
@@ -34,13 +34,13 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
private static final int HOURS_IN_DAY = 24;
private final Type type;
- private final String coefficient;
- private final String offset;
+ private final String gapMultiplier;
+ private final String baseEffort;
- public DefaultDebtRemediationFunction(@Nullable Type type, @Nullable String coefficient, @Nullable String offset) {
+ public DefaultDebtRemediationFunction(@Nullable Type type, @Nullable String gapMultiplier, @Nullable String baseEffort) {
this.type = type;
- this.coefficient = sanitizeValue("coefficient", coefficient);
- this.offset = sanitizeValue("offset", offset);
+ this.gapMultiplier = sanitizeValue("gap multiplier", gapMultiplier);
+ this.baseEffort = sanitizeValue("base effort", baseEffort);
validate();
}
@@ -62,29 +62,50 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
return type;
}
+ /**
+ * @deprecated since 5.5, replaced by {@link #gapMultiplier}
+ */
@Override
@CheckForNull
+ @Deprecated
public String coefficient() {
- return coefficient;
+ return gapMultiplier();
}
+
+ @Override
+ @CheckForNull
+ public String gapMultiplier() {
+ return gapMultiplier;
+ }
+
+ /**
+ * @deprecated since 5.5, replaced by {@link #baseEffort}
+ */
@Override
@CheckForNull
+ @Deprecated
public String offset() {
- return offset;
+ return baseEffort();
}
+ @Override
+ public String baseEffort() {
+ return baseEffort;
+ }
+
+
private void validate() {
checkArgument(type != null, "Remediation function type cannot be null");
switch (type) {
case LINEAR:
- checkArgument(this.coefficient != null && this.offset == null, "Linear functions must only have a non empty coefficient");
+ checkArgument(this.gapMultiplier != null && this.baseEffort == null, "Linear functions must only have a non empty gap multiplier");
break;
case LINEAR_OFFSET:
- checkArgument(this.coefficient != null && this.offset != null, "Linear with offset functions must have both non null coefficient and offset");
+ checkArgument(this.gapMultiplier != null && this.baseEffort != null, "Linear with offset functions must have both non null gap multiplier and base effort");
break;
case CONSTANT_ISSUE:
- checkArgument(this.coefficient == null && this.offset != null, "Constant/issue functions must only have a non empty offset");
+ checkArgument(this.gapMultiplier == null && this.baseEffort != null, "Constant/issue functions must only have a non empty base effort");
break;
default:
throw new IllegalArgumentException(String.format("Unknown type on %s", this));
@@ -101,8 +122,8 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
}
DefaultDebtRemediationFunction other = (DefaultDebtRemediationFunction) o;
return new EqualsBuilder()
- .append(coefficient, other.coefficient())
- .append(offset, other.offset())
+ .append(gapMultiplier, other.gapMultiplier())
+ .append(baseEffort, other.baseEffort())
.append(type, other.type())
.isEquals();
}
@@ -110,8 +131,8 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
@Override
public int hashCode() {
int result = type.hashCode();
- result = 31 * result + (coefficient != null ? coefficient.hashCode() : 0);
- result = 31 * result + (offset != null ? offset.hashCode() : 0);
+ result = 31 * result + (gapMultiplier != null ? gapMultiplier.hashCode() : 0);
+ result = 31 * result + (baseEffort != null ? baseEffort.hashCode() : 0);
return result;
}
@@ -119,8 +140,8 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
public String toString() {
return Objects.toStringHelper(DebtRemediationFunction.class)
.add("type", type)
- .add("coefficient", coefficient)
- .add("offset", offset)
+ .add("gap multiplier", gapMultiplier)
+ .add("base effort", baseEffort)
.toString();
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java
index f77d9fdfb41..823ff15fe84 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java
@@ -19,12 +19,11 @@
*/
package org.sonar.api.server.rule;
+import javax.annotation.Nullable;
import org.sonar.api.server.debt.DebtRemediationFunction;
import org.sonar.api.server.debt.internal.DefaultDebtRemediationFunction;
import org.sonar.api.utils.MessageException;
-import javax.annotation.Nullable;
-
/**
* Factory of {@link org.sonar.api.server.debt.DebtRemediationFunction} that keeps
* a context of rule for better error messages. Used only when declaring rules.
@@ -42,24 +41,24 @@ class DefaultDebtRemediationFunctions implements RulesDefinition.DebtRemediation
}
@Override
- public DebtRemediationFunction linear(String coefficient) {
- return create(DefaultDebtRemediationFunction.Type.LINEAR, coefficient, null);
+ public DebtRemediationFunction linear(String gapMultiplier) {
+ return create(DefaultDebtRemediationFunction.Type.LINEAR, gapMultiplier, null);
}
@Override
- public DebtRemediationFunction linearWithOffset(String coefficient, String offset) {
- return create(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET, coefficient, offset);
+ public DebtRemediationFunction linearWithOffset(String gapMultiplier, String baseEffort) {
+ return create(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET, gapMultiplier, baseEffort);
}
@Override
- public DebtRemediationFunction constantPerIssue(String offset) {
- return create(DefaultDebtRemediationFunction.Type.CONSTANT_ISSUE, null, offset);
+ public DebtRemediationFunction constantPerIssue(String baseEffort) {
+ return create(DefaultDebtRemediationFunction.Type.CONSTANT_ISSUE, null, baseEffort);
}
@Override
- public DebtRemediationFunction create(DebtRemediationFunction.Type type, @Nullable String coefficient, @Nullable String offset) {
+ public DebtRemediationFunction create(DebtRemediationFunction.Type type, @Nullable String gapMultiplier, @Nullable String baseEffort) {
try {
- return new DefaultDebtRemediationFunction(type, coefficient, offset);
+ return new DefaultDebtRemediationFunction(type, gapMultiplier, baseEffort);
} catch (Exception e) {
throw MessageException.of(String.format("The rule '%s:%s' is invalid : %s ", this.repoKey, this.key, e.getMessage()));
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
index 382b29adea5..94d5ef5c065 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
@@ -625,33 +625,33 @@ public interface RulesDefinition {
interface DebtRemediationFunctions {
/**
- * Shortcut for {@code create(Type.LINEAR, coefficient, null)}.
- * @param coefficient the duration to fix one issue. See {@link DebtRemediationFunction} for details about format.
+ * Shortcut for {@code create(Type.LINEAR, gap multiplier, null)}.
+ * @param gapMultiplier the duration to fix one issue. See {@link DebtRemediationFunction} for details about format.
* @see org.sonar.api.server.debt.DebtRemediationFunction.Type#LINEAR
*/
- DebtRemediationFunction linear(String coefficient);
+ DebtRemediationFunction linear(String gapMultiplier);
/**
- * Shortcut for {@code create(Type.LINEAR_OFFSET, coefficient, offset)}.
- * @param coefficient duration to fix one point of complexity. See {@link DebtRemediationFunction} for details and format.
- * @param offset duration to make basic analysis. See {@link DebtRemediationFunction} for details and format.
+ * Shortcut for {@code create(Type.LINEAR_OFFSET, gap multiplier, base effort)}.
+ * @param gapMultiplier duration to fix one point of complexity. See {@link DebtRemediationFunction} for details and format.
+ * @param baseEffort duration to make basic analysis. See {@link DebtRemediationFunction} for details and format.
* @see org.sonar.api.server.debt.DebtRemediationFunction.Type#LINEAR_OFFSET
*/
- DebtRemediationFunction linearWithOffset(String coefficient, String offset);
+ DebtRemediationFunction linearWithOffset(String gapMultiplier, String baseEffort);
/**
- * Shortcut for {@code create(Type.CONSTANT_ISSUE, null, constant)}.
- * @param constant cost per issue. See {@link DebtRemediationFunction} for details and format.
+ * Shortcut for {@code create(Type.CONSTANT_ISSUE, null, base effort)}.
+ * @param baseEffort cost per issue. See {@link DebtRemediationFunction} for details and format.
* @see org.sonar.api.server.debt.DebtRemediationFunction.Type#CONSTANT_ISSUE
*/
- DebtRemediationFunction constantPerIssue(String constant);
+ DebtRemediationFunction constantPerIssue(String baseEffort);
/**
* Flexible way to create a {@link DebtRemediationFunction}. An unchecked exception is thrown if
* coefficient and/or offset are not valid according to the given @{code type}.
* @since 5.3
*/
- DebtRemediationFunction create(DebtRemediationFunction.Type type, @Nullable String coefficient, @Nullable String offset);
+ DebtRemediationFunction create(DebtRemediationFunction.Type type, @Nullable String gapMultiplier, @Nullable String baseEffort);
}
class NewRule {
@@ -666,7 +666,7 @@ public interface RulesDefinition {
private boolean template;
private RuleStatus status = RuleStatus.defaultStatus();
private DebtRemediationFunction debtRemediationFunction;
- private String effortToFixDescription;
+ private String gapDescription;
private final Set<String> tags = Sets.newTreeSet();
private final Map<String, NewParam> paramsByKey = Maps.newHashMap();
private final DebtRemediationFunctions functions;
@@ -811,16 +811,24 @@ public interface RulesDefinition {
}
/**
+ * @deprecated since 5.5, replaced by {@link #setGapDescription(String)}
+ */
+ @Deprecated
+ public NewRule setEffortToFixDescription(@Nullable String s) {
+ return setGapDescription(s);
+ }
+
+ /**
* For rules that use LINEAR or LINEAR_OFFSET remediation functions, the meaning
- * of the function parameter (= "effort to fix") must be set. This description
- * explains what 1 point of "effort to fix" represents for the rule.
+ * of the function parameter (= "gap") must be set. This description
+ * explains what 1 point of "gap" represents for the rule.
* <p/>
* Example: for the "Insufficient condition coverage", this description for the
- * remediation function coefficient/offset would be something like
+ * remediation function gap multiplier/base effort would be something like
* "Effort to test one uncovered condition".
*/
- public NewRule setEffortToFixDescription(@Nullable String s) {
- this.effortToFixDescription = s;
+ public NewRule setGapDescription(@Nullable String s) {
+ this.gapDescription = s;
return this;
}
@@ -901,7 +909,7 @@ public interface RulesDefinition {
private final String severity;
private final boolean template;
private final DebtRemediationFunction debtRemediationFunction;
- private final String effortToFixDescription;
+ private final String gapDescription;
private final Set<String> tags;
private final Map<String, Param> params;
private final RuleStatus status;
@@ -918,7 +926,7 @@ public interface RulesDefinition {
this.template = newRule.template;
this.status = newRule.status;
this.debtRemediationFunction = newRule.debtRemediationFunction;
- this.effortToFixDescription = newRule.effortToFixDescription;
+ this.gapDescription = newRule.gapDescription;
this.type = newRule.type == null ? RuleTagsToTypeConverter.convert(newRule.tags) : newRule.type;
this.tags = ImmutableSortedSet.copyOf(Sets.difference(newRule.tags, RuleTagsToTypeConverter.RESERVED_TAGS));
ImmutableMap.Builder<String, Param> paramsBuilder = ImmutableMap.builder();
@@ -986,9 +994,18 @@ public interface RulesDefinition {
return debtRemediationFunction;
}
+ /**
+ * @deprecated since 5.5, replaced by {@link #gapDescription()}
+ */
+ @Deprecated
@CheckForNull
public String effortToFixDescription() {
- return effortToFixDescription;
+ return gapDescription();
+ }
+
+ @CheckForNull
+ public String gapDescription() {
+ return gapDescription;
}
@CheckForNull
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java
index 83158579c73..996a044d19b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java
@@ -121,32 +121,37 @@ import static org.apache.commons.lang.StringUtils.trim;
* &lt;param&gt;
* &lt;key&gt;another-param&lt;/key&gt;
* &lt;/param&gt;
- **
- * &lt;!-- SQALE debt - type of debt remediation function --&gt;
+ *
+ * &lt;!-- Quality Model - type of debt remediation function --&gt;
* &lt;!-- See enum {@link org.sonar.api.server.debt.DebtRemediationFunction.Type} for supported values --&gt;
- * &lt;!-- Since 5.3 --&gt;
- * &lt;debtRemediationFunction&gt;LINEAR_OFFSET&lt;/debtRemediationFunction&gt;
+ * &lt;!-- It was previously named 'debtRemediationFunction' which is still supported but deprecated since 5.5 --&gt;
+ * &lt;!-- Since 5.5 --&gt;
+ * &lt;remediationFunction&gt;LINEAR_OFFSET&lt;/remediationFunction&gt;
*
- * &lt;!-- SQALE debt - raw description of the "effort to fix", used for some types of remediation functions. --&gt;
- * &lt;!-- See {@link org.sonar.api.server.rule.RulesDefinition.NewRule#setEffortToFixDescription(String)} --&gt;
- * &lt;!-- Since 5.3 --&gt;
- * &lt;effortToFixDescription&gt;Effort to test one uncovered condition&lt;/effortToFixDescription&gt;
+ * &lt;!-- Quality Model - raw description of the "gap", used for some types of remediation functions. --&gt;
+ * &lt;!-- See {@link org.sonar.api.server.rule.RulesDefinition.NewRule#setGapDescription(String)} --&gt;
+ * &lt;!-- It was previously named 'effortToFixDescription' which is still supported but deprecated since 5.5 --&gt;
+ * &lt;!-- Since 5.5 --&gt;
+ * &lt;gapDescription&gt;Effort to test one uncovered condition&lt;/gapFixDescription&gt;
*
- * &lt;!-- SQALE debt - coefficient of debt remediation function. Must be defined only for some function types. --&gt;
+ * &lt;!-- Quality Model - gap multiplier of debt remediation function. Must be defined only for some function types. --&gt;
* &lt;!-- See {@link org.sonar.api.server.rule.RulesDefinition.DebtRemediationFunctions} --&gt;
- * &lt;!-- Since 5.3 --&gt;
- * &lt;debtRemediationFunctionCoefficient&gt;10min&lt;/debtRemediationFunctionCoefficient&gt;
+ * &lt;!-- It was previously named 'debtRemediationFunctionCoefficient' which is still supported but deprecated since 5.5 --&gt;
+ * &lt;!-- Since 5.5 --&gt;
+ * &lt;remediationFunctionGapMultiplier&gt;10min&lt;/remediationFunctionGapMultiplier&gt;
*
- * &lt;!-- SQALE debt - offset of debt remediation function. Must be defined only for some function types. --&gt;
+ * &lt;!-- Quality Model - base effort of debt remediation function. Must be defined only for some function types. --&gt;
* &lt;!-- See {@link org.sonar.api.server.rule.RulesDefinition.DebtRemediationFunctions} --&gt;
- * &lt;!-- Since 5.3 --&gt;
- * &lt;debtRemediationFunctionOffset&gt;2min&lt;/debtRemediationFunctionOffset&gt;
+ * &lt;!-- It was previously named 'debtRemediationFunctionOffset' which is still supported but deprecated since 5.5 --&gt;
+ * &lt;!-- Since 5.5 --&gt;
+ * &lt;remediationFunctionBaseEffort&gt;2min&lt;/remediationFunctionBaseEffort&gt;
*
* &lt;!-- Deprecated field, replaced by "internalKey" --&gt;
* &lt;configKey&gt;Checker/TreeWalker/LocalVariableName&lt;/configKey&gt;
*
* &lt;!-- Deprecated field, replaced by "severity" --&gt;
* &lt;priority&gt;BLOCKER&lt;/priority&gt;
+ *
* &lt;/rule&gt;
* &lt;/rules&gt;
* </pre>
@@ -162,7 +167,7 @@ import static org.apache.commons.lang.StringUtils.trim;
* &lt;tag&gt;security&lt;/tag&gt;
* &lt;tag&gt;user-experience&lt;/tag&gt;
* &lt;debtRemediationFunction&gt;CONSTANT_ISSUE&lt;/debtRemediationFunction&gt;
- * &lt;debtRemediationFunctionOffset&gt;10min&lt;/debtRemediationFunctionOffset&gt;
+ * &lt;debtRemediationFunctionBaseOffset&gt;10min&lt;/debtRemediationFunctionBaseOffset&gt;
* &lt;/rule&gt;
*
* &lt;!-- another rules... --&gt;
@@ -238,10 +243,10 @@ public class RulesDefinitionXmlLoader {
String type = null;
RuleStatus status = RuleStatus.defaultStatus();
boolean template = false;
- String effortToFixDescription = null;
+ String gapDescription = null;
String debtRemediationFunction = null;
- String debtRemediationFunctionOffset = null;
- String debtRemediationFunctionCoeff = null;
+ String debtRemediationFunctionGapMultiplier = null;
+ String debtRemediationFunctionBaseEffort = null;
List<ParamStruct> params = new ArrayList<>();
List<String> tags = new ArrayList<>();
@@ -288,17 +293,17 @@ public class RulesDefinitionXmlLoader {
} else if (equalsIgnoreCase("cardinality", nodeName)) {
template = Cardinality.MULTIPLE == Cardinality.valueOf(nodeValue(cursor));
- } else if (equalsIgnoreCase("effortToFixDescription", nodeName)) {
- effortToFixDescription = nodeValue(cursor);
+ } else if (equalsIgnoreCase("gapDescription", nodeName) || equalsIgnoreCase("effortToFixDescription", nodeName)) {
+ gapDescription = nodeValue(cursor);
- } else if (equalsIgnoreCase("debtRemediationFunction", nodeName)) {
+ } else if (equalsIgnoreCase("remediationFunction", nodeName) || equalsIgnoreCase("debtRemediationFunction", nodeName)) {
debtRemediationFunction = nodeValue(cursor);
- } else if (equalsIgnoreCase("debtRemediationFunctionOffset", nodeName)) {
- debtRemediationFunctionOffset = nodeValue(cursor);
+ } else if (equalsIgnoreCase("remediationFunctionBaseEffort", nodeName) || equalsIgnoreCase("debtRemediationFunctionOffset", nodeName)) {
+ debtRemediationFunctionGapMultiplier = nodeValue(cursor);
- } else if (equalsIgnoreCase("debtRemediationFunctionCoefficient", nodeName)) {
- debtRemediationFunctionCoeff = nodeValue(cursor);
+ } else if (equalsIgnoreCase("remediationFunctionGapMultiplier", nodeName) || equalsIgnoreCase("debtRemediationFunctionCoefficient", nodeName)) {
+ debtRemediationFunctionBaseEffort = nodeValue(cursor);
} else if (equalsIgnoreCase("status", nodeName)) {
String s = nodeValue(cursor);
@@ -322,12 +327,12 @@ public class RulesDefinitionXmlLoader {
.setTags(tags.toArray(new String[tags.size()]))
.setTemplate(template)
.setStatus(status)
- .setEffortToFixDescription(effortToFixDescription);
+ .setGapDescription(gapDescription);
if (type != null) {
rule.setType(RuleType.valueOf(type));
}
fillDescription(rule, descriptionFormat, description);
- fillRemediationFunction(rule, debtRemediationFunction, debtRemediationFunctionOffset, debtRemediationFunctionCoeff);
+ fillRemediationFunction(rule, debtRemediationFunction, debtRemediationFunctionGapMultiplier, debtRemediationFunctionBaseEffort);
fillParams(rule, params);
} catch (Exception e) {
throw new IllegalArgumentException(format("Fail to load the rule with key [%s:%s]", repo.key(), key), e);