diff options
3 files changed, 15 insertions, 2 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java index 5a6d0117200..f216f042606 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultRule.java @@ -39,6 +39,7 @@ public class DefaultRule implements Rule { private final Integer id; private final String name; private final String severity; + private final String type; private final String description; private final String internalKey; private final RuleStatus status; @@ -49,6 +50,7 @@ public class DefaultRule implements Rule { this.id = newRule.id; this.name = newRule.name; this.severity = newRule.severity; + this.type = newRule.type; this.description = newRule.description; this.internalKey = newRule.internalKey; this.status = newRule.status; @@ -80,6 +82,11 @@ public class DefaultRule implements Rule { return severity; } + @CheckForNull + public String type() { + return type; + } + @Override public String description() { return description; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java index 70fded597b9..395d5e18146 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewRule.java @@ -37,6 +37,7 @@ public class NewRule { String name; String description; String severity = DEFAULT_SEVERITY; + String type; String internalKey; RuleStatus status = RuleStatus.defaultStatus(); Map<String, NewRuleParam> params = new HashMap<>(); @@ -64,6 +65,11 @@ public class NewRule { this.severity = StringUtils.defaultIfBlank(severity, DEFAULT_SEVERITY); return this; } + + public NewRule setType(@Nullable String type) { + this.type = type; + return this; + } public NewRule setStatus(@Nullable RuleStatus s) { this.status = (RuleStatus) ObjectUtils.defaultIfNull(s, RuleStatus.defaultStatus()); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java index 6c4066433b2..d3221b9a396 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java @@ -98,8 +98,8 @@ public class ChecksMediumTest { } - private LoadedActiveRule createActiveRuleWithParam(String repositoryKey, String ruleKey, @Nullable String templateRuleKey, String name, @Nullable String severity, - @Nullable String internalKey, @Nullable String languag, String paramKey, String paramValue) { + private LoadedActiveRule createActiveRuleWithParam(String repositoryKey, String ruleKey, @Nullable String templateRuleKey, String name, + @Nullable String severity, @Nullable String internalKey, @Nullable String languag, String paramKey, String paramValue) { LoadedActiveRule r = new LoadedActiveRule(); r.setInternalKey(internalKey); |