aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api-impl/src/main
diff options
context:
space:
mode:
authorBenjamin Campomenosi <benjamin.campomenosi@sonarsource.com>2023-04-14 12:11:57 +0200
committersonartech <sonartech@sonarsource.com>2023-04-24 20:04:24 +0000
commit331777b6396ea814563c31974197f2364c64342c (patch)
tree55534a601ba25b951bb02b02b4574e8805c098ab /sonar-plugin-api-impl/src/main
parent6730a1380566fba85f5fa859a84eb237d336a757 (diff)
downloadsonarqube-331777b6396ea814563c31974197f2364c64342c.tar.gz
sonarqube-331777b6396ea814563c31974197f2364c64342c.zip
SONAR-19050 update RuleDto to add characteristics
Diffstat (limited to 'sonar-plugin-api-impl/src/main')
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java17
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java14
2 files changed, 17 insertions, 14 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
index 42418950a25..d2e606bee1a 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
@@ -26,8 +26,8 @@ import org.sonar.api.batch.rule.Severity;
import org.sonar.api.batch.sensor.internal.SensorStorage;
import org.sonar.api.batch.sensor.issue.ExternalIssue;
import org.sonar.api.batch.sensor.issue.NewExternalIssue;
-import org.sonar.api.code.CodeCharacteristic;
import org.sonar.api.rule.RuleKey;
+import org.sonar.api.rules.RuleCharacteristic;
import org.sonar.api.rules.RuleType;
import static java.lang.String.format;
@@ -39,6 +39,7 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs
private Long effort;
private Severity severity;
private RuleType type;
+ private RuleCharacteristic characteristic;
private String engineId;
private String ruleId;
@@ -100,9 +101,8 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs
}
@CheckForNull
- @Override
- public CodeCharacteristic characteristic() {
- throw new IllegalStateException("Not implemented yet");
+ public RuleCharacteristic characteristic() {
+ return characteristic;
}
@Override
@@ -133,14 +133,15 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs
}
@Override
- public DefaultExternalIssue type(RuleType type) {
- this.type = type;
+ public DefaultExternalIssue characteristic(RuleCharacteristic characteristic) {
+ this.characteristic = characteristic;
return this;
}
@Override
- public NewExternalIssue characteristic(CodeCharacteristic characteristic) {
- throw new IllegalStateException("Not implemented yet");
+ public DefaultExternalIssue type(RuleType type) {
+ this.type = type;
+ return this;
}
}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java
index 52a243b8fca..aefa37f67e7 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRule.java
@@ -26,7 +26,7 @@ import org.sonar.api.batch.sensor.internal.DefaultStorable;
import org.sonar.api.batch.sensor.internal.SensorStorage;
import org.sonar.api.batch.sensor.rule.AdHocRule;
import org.sonar.api.batch.sensor.rule.NewAdHocRule;
-import org.sonar.api.code.CodeCharacteristic;
+import org.sonar.api.rules.RuleCharacteristic;
import org.sonar.api.rules.RuleType;
import static org.apache.commons.lang.StringUtils.isNotBlank;
@@ -35,6 +35,8 @@ import static org.sonar.api.utils.Preconditions.checkState;
public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewAdHocRule {
private Severity severity;
private RuleType type;
+
+ private RuleCharacteristic characteristic;
private String name;
private String description;
private String engineId;
@@ -97,8 +99,8 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA
@CheckForNull
@Override
- public CodeCharacteristic characteristic() {
- throw new IllegalStateException("Not implemented yet");
+ public RuleCharacteristic characteristic() {
+ return characteristic;
}
@Override
@@ -132,8 +134,8 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA
}
@Override
- public NewAdHocRule characteristic(CodeCharacteristic characteristic) {
- throw new IllegalStateException("Not implemented yet");
+ public DefaultAdHocRule characteristic(RuleCharacteristic characteristic) {
+ this.characteristic = characteristic;
+ return this;
}
-
}