aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2018-04-13 15:59:23 +0200
committerSonarTech <sonartech@sonarsource.com>2018-04-26 20:20:51 +0200
commit6c5aad9a2d48cd783993a3a31911e307bf6827f5 (patch)
treee12910dde39fb187663a7f9bf6c93d73bb45efef /sonar-plugin-api
parent4cbf46ae604e6619c5b1fdaab81f5dd28f464a0e (diff)
downloadsonarqube-6c5aad9a2d48cd783993a3a31911e307bf6827f5.tar.gz
sonarqube-6c5aad9a2d48cd783993a3a31911e307bf6827f5.zip
SONAR-10543 Update test to v7.2 and remove descriptionUrl and ruleTitle from scanner
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java12
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java24
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java29
5 files changed, 1 insertions, 76 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java
index ec72c49de1a..b151a6582aa 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java
@@ -33,12 +33,6 @@ public interface ExternalIssue extends IIssue {
Severity severity();
/**
- * Link to a page describing more details about the rule that triggered this issue.
- */
- @CheckForNull
- String descriptionUrl();
-
- /**
* Effort to fix the issue, in minutes.
*/
@CheckForNull
@@ -48,9 +42,5 @@ public interface ExternalIssue extends IIssue {
* Type of the issue.
*/
RuleType type();
-
- /**
- * Short description of the rule. Should not depend on the issue being raised.
- */
- String ruleTitle();
+
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java
index 8049c44e1dc..d2e55a999ee 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java
@@ -63,11 +63,6 @@ public interface NewExternalIssue {
NewExternalIssue addLocation(NewIssueLocation secondaryLocation);
/**
- * Add a URL pointing to more information about the rule triggering this issue.
- */
- NewExternalIssue descriptionUrl(String url);
-
- /**
* Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue.
* It should be a <b>path that backtracks the issue from its primary location to the start of the flow</b>.
* Several flows can be registered.
@@ -80,11 +75,6 @@ public interface NewExternalIssue {
NewIssueLocation newLocation();
/**
- * Add the description of the rule. Should not depend on the issue being raised.
- */
- NewExternalIssue ruleTitle(String title);
-
- /**
* Save the issue. If rule key is unknown or rule not enabled in the current quality profile then a warning is logged but no exception
* is thrown.
*/
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
index 6ffcb5055e8..a0bd77b53c7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssue.java
@@ -34,9 +34,7 @@ import static java.util.Objects.requireNonNull;
public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIssue> implements ExternalIssue, NewExternalIssue {
private Long effort;
private Severity severity;
- private String url;
private RuleType type;
- private String ruleTitle;
public DefaultExternalIssue() {
super(null);
@@ -74,24 +72,12 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs
requireNonNull(this.ruleKey, "Rule key is mandatory on external issue");
checkState(primaryLocation != null, "Primary location is mandatory on every external issue");
checkState(primaryLocation.inputComponent().isFile(), "External issues must be located in files");
- checkState(ruleTitle != null, "Rule title is mandatory on every external issue");
checkState(severity != null, "Severity is mandatory on every external issue");
checkState(type != null, "Type is mandatory on every external issue");
storage.store(this);
}
@Override
- public DefaultExternalIssue descriptionUrl(String url) {
- this.url = url;
- return this;
- }
-
- @Override
- public String descriptionUrl() {
- return url;
- }
-
- @Override
public RuleType type() {
return type;
}
@@ -102,14 +88,4 @@ public class DefaultExternalIssue extends AbstractDefaultIssue<DefaultExternalIs
return this;
}
- @Override
- public String ruleTitle() {
- return ruleTitle;
- }
-
- @Override
- public DefaultExternalIssue ruleTitle(String ruleTitle) {
- this.ruleTitle = ruleTitle;
- return this;
- }
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java
index b47ef208fed..0cee9bc2a96 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/internal/SensorContextTesterTest.java
@@ -117,7 +117,6 @@ public class SensorContextTesterTest {
.forRule(RuleKey.of("repo", "rule"))
.type(RuleType.BUG)
.severity(Severity.BLOCKER)
- .ruleTitle("title")
.save();
newExternalIssue = tester.newExternalIssue();
newExternalIssue
@@ -125,7 +124,6 @@ public class SensorContextTesterTest {
.type(RuleType.BUG)
.severity(Severity.BLOCKER)
.forRule(RuleKey.of("repo", "rule"))
- .ruleTitle("title")
.save();
assertThat(tester.allExternalIssues()).hasSize(2);
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java
index 57998dc4ba8..1176527f04c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/issue/internal/DefaultExternalIssueTest.java
@@ -52,19 +52,15 @@ public class DefaultExternalIssueTest {
.message("Wrong way!"))
.forRule(RuleKey.of("repo", "rule"))
.remediationEffort(10l)
- .descriptionUrl("url")
.type(RuleType.BUG)
- .ruleTitle("rule")
.severity(Severity.BLOCKER);
assertThat(issue.primaryLocation().inputComponent()).isEqualTo(inputFile);
assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("repo", "rule"));
assertThat(issue.primaryLocation().textRange().start().line()).isEqualTo(1);
assertThat(issue.remediationEffort()).isEqualTo(10l);
- assertThat(issue.descriptionUrl()).isEqualTo("url");
assertThat(issue.type()).isEqualTo(RuleType.BUG);
assertThat(issue.severity()).isEqualTo(Severity.BLOCKER);
- assertThat(issue.ruleTitle()).isEqualTo("rule");
assertThat(issue.primaryLocation().message()).isEqualTo("Wrong way!");
issue.save();
@@ -82,8 +78,6 @@ public class DefaultExternalIssueTest {
.message("Wrong way!"))
.forRule(RuleKey.of("repo", "rule"))
.remediationEffort(10l)
- .descriptionUrl("url")
- .ruleTitle("rule")
.severity(Severity.BLOCKER);
exception.expect(IllegalStateException.class);
@@ -100,8 +94,6 @@ public class DefaultExternalIssueTest {
.message("Wrong way!"))
.forRule(RuleKey.of("repo", "rule"))
.remediationEffort(10l)
- .descriptionUrl("url")
- .ruleTitle("rule")
.severity(Severity.BLOCKER);
exception.expect(IllegalStateException.class);
@@ -119,8 +111,6 @@ public class DefaultExternalIssueTest {
.message("Wrong way!"))
.forRule(RuleKey.of("repo", "rule"))
.remediationEffort(10l)
- .descriptionUrl("url")
- .ruleTitle("rule")
.type(RuleType.BUG);
exception.expect(IllegalStateException.class);
@@ -128,23 +118,4 @@ public class DefaultExternalIssueTest {
issue.save();
}
- @Test
- public void fail_to_store_if_no_rule_title() {
- SensorStorage storage = mock(SensorStorage.class);
- DefaultExternalIssue issue = new DefaultExternalIssue(storage)
- .at(new DefaultIssueLocation()
- .on(inputFile)
- .at(inputFile.selectLine(1))
- .message("Wrong way!"))
- .forRule(RuleKey.of("repo", "rule"))
- .remediationEffort(10l)
- .descriptionUrl("url")
- .severity(Severity.BLOCKER)
- .type(RuleType.BUG);
-
- exception.expect(IllegalStateException.class);
- exception.expectMessage("Rule title is mandatory");
- issue.save();
- }
-
}