diff options
Diffstat (limited to 'sonar-plugin-api-impl')
5 files changed, 45 insertions, 26 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 c12df1015e4..b8cd113e0b7 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 @@ -19,6 +19,8 @@ */ package org.sonar.api.batch.sensor.issue.internal; +import java.util.Collections; +import java.util.Map; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.batch.fs.internal.DefaultInputProject; @@ -26,8 +28,9 @@ 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.issue.impact.SoftwareQuality; import org.sonar.api.rule.RuleKey; +import org.sonar.api.rules.CleanCodeAttribute; import org.sonar.api.rules.RuleType; import static java.lang.String.format; @@ -64,6 +67,11 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs } @Override + public NewExternalIssue addImpact(SoftwareQuality softwareQuality, org.sonar.api.issue.impact.Severity severity) { + return this; + } + + @Override public String engineId() { return engineId; } @@ -99,9 +107,14 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs return type; } + @Override + public Map<SoftwareQuality, org.sonar.api.issue.impact.Severity> impacts() { + return Collections.emptyMap(); + } + @CheckForNull @Override - public CodeCharacteristic characteristic() { + public CleanCodeAttribute cleanCodeAttribute() { return null; } @@ -139,8 +152,7 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs } @Override - public NewExternalIssue characteristic(CodeCharacteristic characteristic) { - // no op + public NewExternalIssue cleanCodeAttribute(CleanCodeAttribute attribute) { return this; } diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java index 6a585ae3779..4790c3f80a6 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java @@ -20,7 +20,9 @@ package org.sonar.api.batch.sensor.issue.internal; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; import org.sonar.api.batch.fs.internal.DefaultInputProject; @@ -31,6 +33,7 @@ import org.sonar.api.batch.sensor.issue.IssueLocation; import org.sonar.api.batch.sensor.issue.NewIssue; import org.sonar.api.batch.sensor.issue.fix.NewQuickFix; import org.sonar.api.batch.sensor.issue.fix.QuickFix; +import org.sonar.api.issue.impact.SoftwareQuality; import org.sonar.api.rule.RuleKey; import static java.lang.String.format; @@ -77,6 +80,11 @@ public class DefaultIssue extends AbstractDefaultIssue<DefaultIssue> implements } @Override + public DefaultIssue overrideImpact(SoftwareQuality softwareQuality, org.sonar.api.issue.impact.Severity severity) { + return null; + } + + @Override public DefaultIssue setQuickFixAvailable(boolean quickFixAvailable) { this.quickFixAvailable = quickFixAvailable; return this; @@ -135,6 +143,11 @@ public class DefaultIssue extends AbstractDefaultIssue<DefaultIssue> implements } @Override + public Map<SoftwareQuality, org.sonar.api.issue.impact.Severity> overridenImpacts() { + return Collections.emptyMap(); + } + + @Override public Double gap() { return this.gap; } 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 6ececae895f..2edc54cf8a3 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 @@ -19,6 +19,8 @@ */ package org.sonar.api.batch.sensor.rule.internal; +import java.util.Collections; +import java.util.Map; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.batch.rule.Severity; @@ -26,7 +28,8 @@ 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.issue.impact.SoftwareQuality; +import org.sonar.api.rules.CleanCodeAttribute; import org.sonar.api.rules.RuleType; import static org.apache.commons.lang.StringUtils.isNotBlank; @@ -55,6 +58,11 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA } @Override + public DefaultAdHocRule addDefaultImpact(SoftwareQuality softwareQuality, org.sonar.api.issue.impact.Severity severity) { + return this; + } + + @Override public String engineId() { return engineId; } @@ -95,9 +103,14 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA return type; } + @Override + public Map<SoftwareQuality, org.sonar.api.issue.impact.Severity> defaultImpacts() { + return Collections.emptyMap(); + } + @CheckForNull @Override - public CodeCharacteristic characteristic() { + public CleanCodeAttribute cleanCodeAttribute() { return null; } @@ -132,8 +145,7 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA } @Override - public NewAdHocRule characteristic(CodeCharacteristic characteristic) { - // no op + public DefaultAdHocRule cleanCodeAttribute(CleanCodeAttribute attribute) { return this; } diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java index 4b48ec35902..3047ab7415b 100644 --- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java +++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java @@ -30,7 +30,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputProject; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; import org.sonar.api.batch.rule.Severity; import org.sonar.api.batch.sensor.internal.SensorStorage; -import org.sonar.api.code.CodeCharacteristic; import org.sonar.api.rule.RuleKey; import org.sonar.api.rules.RuleType; @@ -163,12 +162,4 @@ public class DefaultExternalIssueTest { .isInstanceOf(IllegalStateException.class) .hasMessageContaining("Severity is mandatory"); } - - @Test - public void characteristic_shouldBeNoOp() { - SensorStorage storage = mock(SensorStorage.class); - DefaultExternalIssue issue = new DefaultExternalIssue(project, storage); - issue.characteristic(CodeCharacteristic.ROBUST); - assertThat(issue.characteristic()).isNull(); - } } diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java index e46406b27e4..354a729c0bb 100644 --- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java +++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/rule/internal/DefaultAdHocRuleTest.java @@ -23,7 +23,6 @@ import org.junit.Test; import org.sonar.api.batch.rule.Severity; import org.sonar.api.batch.sensor.internal.SensorStorage; import org.sonar.api.batch.sensor.rule.NewAdHocRule; -import org.sonar.api.code.CodeCharacteristic; import org.sonar.api.rules.RuleType; import static org.assertj.core.api.Assertions.assertThat; @@ -147,12 +146,4 @@ public class DefaultAdHocRuleTest { .isInstanceOf(IllegalStateException.class) .hasMessageContaining("Type is mandatory"); } - - @Test - public void characteristic_shouldBeNoOp() { - SensorStorage storage = mock(SensorStorage.class); - DefaultAdHocRule rule = new DefaultAdHocRule(storage); - rule.characteristic(CodeCharacteristic.CLEAR); - assertThat(rule.characteristic()).isNull(); - } } |