aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-18 11:04:47 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-18 11:04:47 +0100
commit7c6ffbab1b4038b2a5e5c01acb5b3bc96c7db9a9 (patch)
treec1fcc2e2b31306c02925281f0e894601ad64421c /sonar-core
parent8c7b10b6bf2712e1d7201ebd025aed36fad7ead6 (diff)
downloadsonarqube-7c6ffbab1b4038b2a5e5c01acb5b3bc96c7db9a9.tar.gz
sonarqube-7c6ffbab1b4038b2a5e5c01acb5b3bc96c7db9a9.zip
SONAR-5119 Do not display warning log if rule characteristic has been overriden
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java3
-rw-r--r--sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDto.java10
4 files changed, 7 insertions, 13 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java b/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java
index b6b280cf96b..52f79d26ce8 100644
--- a/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java
@@ -24,6 +24,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.check.Cardinality;
+import org.sonar.core.technicaldebt.db.CharacteristicDto;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@@ -32,8 +33,6 @@ import java.util.Date;
public final class RuleDto {
- public static final Integer DISABLED_CHARACTERISTIC_ID = -1;
-
private Integer id;
private String repositoryKey;
private String ruleKey;
@@ -315,7 +314,7 @@ public final class RuleDto {
}
public boolean hasCharacteristic(){
- return (characteristicId != null && !DISABLED_CHARACTERISTIC_ID.equals(characteristicId)) || defaultCharacteristicId != null;
+ return (characteristicId != null && !CharacteristicDto.DISABLED_CHARACTERISTIC_ID.equals(characteristicId)) || defaultCharacteristicId != null;
}
@Override
diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java
index aeb1a9655b0..a6164c1c3e5 100644
--- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java
+++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java
@@ -38,7 +38,6 @@ import org.sonar.api.technicaldebt.batch.internal.DefaultCharacteristic;
import org.sonar.api.technicaldebt.batch.internal.DefaultRequirement;
import org.sonar.api.utils.ValidationMessages;
import org.sonar.api.utils.internal.WorkDuration;
-import org.sonar.core.technicaldebt.db.CharacteristicDto;
import javax.annotation.CheckForNull;
import javax.xml.stream.XMLInputFactory;
@@ -227,7 +226,7 @@ public class TechnicalDebtXMLImporter implements ServerExtension {
if ("linear_threshold".equals(functionKey)) {
function.setTextValue(DefaultRequirement.FUNCTION_LINEAR);
offset.setValue(0);
- offset.setTextValue(CharacteristicDto.DAYS);
+ offset.setTextValue("d");
messages.addWarningText(String.format("Linear with threshold function is no longer used, function of the requirement '%s' is replaced by linear.", requirement.ruleKey()));
} else if ("constant_resource".equals(functionKey)) {
messages.addWarningText(String.format("Constant/file function is no longer used, requirements '%s' are ignored.", requirement.ruleKey()));
diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java
index 9c927d47515..42ef216b738 100644
--- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java
@@ -38,7 +38,7 @@ public class CharacteristicDao implements BatchComponent, ServerComponent {
}
/**
- * @return enabled root characteristics, characteristics and requirements
+ * @return enabled root characteristics and characteristics
*
*/
public List<CharacteristicDto> selectEnabledCharacteristics() {
diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDto.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDto.java
index fc394d4a1c1..4f0b85be817 100644
--- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDto.java
@@ -30,9 +30,7 @@ import java.util.Date;
public class CharacteristicDto implements Serializable {
- public static final String DAYS = "d";
- public static final String MINUTES = "mn";
- public static final String HOURS = "h";
+ public static final Integer DISABLED_CHARACTERISTIC_ID = -1;
private Integer id;
private String kee;
@@ -52,22 +50,20 @@ public class CharacteristicDto implements Serializable {
return this;
}
- @CheckForNull
public String getKey() {
return kee;
}
- public CharacteristicDto setKey(@Nullable String s) {
+ public CharacteristicDto setKey(String s) {
this.kee = s;
return this;
}
- @CheckForNull
public String getName() {
return name;
}
- public CharacteristicDto setName(@Nullable String s) {
+ public CharacteristicDto setName(String s) {
this.name = s;
return this;
}