From 04544fe143c20e8d6e76992d01cb2d2f1f3a938c Mon Sep 17 00:00:00 2001 From: Léo Geoffroy Date: Fri, 28 Jul 2023 15:57:26 +0200 Subject: SONAR-20021 Update plugin-api version --- .../sensor/issue/internal/DefaultExternalIssue.java | 20 ++++++++++++++++---- .../batch/sensor/issue/internal/DefaultIssue.java | 13 +++++++++++++ .../batch/sensor/rule/internal/DefaultAdHocRule.java | 20 ++++++++++++++++---- .../issue/internal/DefaultExternalIssueTest.java | 9 --------- .../sensor/rule/internal/DefaultAdHocRuleTest.java | 9 --------- 5 files changed, 45 insertions(+), 26 deletions(-) (limited to 'sonar-plugin-api-impl') 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; @@ -63,6 +66,11 @@ public class DefaultExternalIssue extends AbstractDefaultIssue impacts() { + return Collections.emptyMap(); + } + @CheckForNull @Override - public CodeCharacteristic characteristic() { + public CleanCodeAttribute cleanCodeAttribute() { return null; } @@ -139,8 +152,7 @@ public class DefaultExternalIssue extends AbstractDefaultIssue implements return this; } + @Override + public DefaultIssue overrideImpact(SoftwareQuality softwareQuality, org.sonar.api.issue.impact.Severity severity) { + return null; + } + @Override public DefaultIssue setQuickFixAvailable(boolean quickFixAvailable) { this.quickFixAvailable = quickFixAvailable; @@ -134,6 +142,11 @@ public class DefaultIssue extends AbstractDefaultIssue implements return this.overriddenSeverity; } + @Override + public Map 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; @@ -54,6 +57,11 @@ public class DefaultAdHocRule extends DefaultStorable implements AdHocRule, NewA return this; } + @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 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(); - } } -- cgit v1.2.3