diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2024-10-18 16:27:20 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-10-21 20:03:59 +0000 |
commit | dd9ebd6a6f4b59c38ce1f1ca494f1d4231291513 (patch) | |
tree | a1a42bbd4e9d1f65a4b84b072be0ebd2e721d2ba /sonar-scanner-engine/src/main/java/org/sonar | |
parent | 691fe9681e59a01bca5e6079e74c2d3995ba3667 (diff) | |
download | sonarqube-dd9ebd6a6f4b59c38ce1f1ca494f1d4231291513.tar.gz sonarqube-dd9ebd6a6f4b59c38ce1f1ca494f1d4231291513.zip |
SONAR-23250 Revert changes made in the plugin API for ActiveRule
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar')
5 files changed, 137 insertions, 4 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java index 53d04e5faa5..47e5f8fe1d7 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java @@ -33,6 +33,7 @@ import org.sonar.api.batch.fs.internal.DefaultInputComponent; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.rule.ActiveRule; import org.sonar.api.batch.rule.ActiveRules; +import org.sonar.api.batch.rule.internal.DefaultActiveRule; import org.sonar.api.batch.sensor.issue.ExternalIssue; import org.sonar.api.batch.sensor.issue.Issue; import org.sonar.api.batch.sensor.issue.Issue.Flow; @@ -78,7 +79,7 @@ public class IssuePublisher { return false; } - ScannerReport.Issue rawIssue = createReportIssue(issue, inputComponent.scannerId(), activeRule.severity(), activeRule.impacts()); + ScannerReport.Issue rawIssue = createReportIssue(issue, inputComponent.scannerId(), activeRule.severity(), ((DefaultActiveRule) activeRule).impacts()); if (filters.accept(inputComponent, rawIssue)) { write(inputComponent.scannerId(), rawIssue); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesLoader.java index 4cc20f04fe6..1bd49f3ec27 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesLoader.java @@ -20,7 +20,6 @@ package org.sonar.scanner.rule; import java.util.List; -import org.sonar.api.batch.rule.LoadedActiveRule; public interface ActiveRulesLoader { List<LoadedActiveRule> load(String qualityProfileKey); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesProvider.java index 8e0691a069e..eb703522dc3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/ActiveRulesProvider.java @@ -25,7 +25,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import org.sonar.api.batch.rule.LoadedActiveRule; import org.sonar.api.batch.rule.internal.ActiveRulesBuilder; import org.sonar.api.batch.rule.internal.DefaultActiveRules; import org.sonar.api.batch.rule.internal.NewActiveRule; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java index 9c2bb5d86d1..78c047d5903 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java @@ -28,7 +28,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; -import org.sonar.api.batch.rule.LoadedActiveRule; import org.sonar.api.impl.utils.ScannerUtils; import org.sonar.api.issue.impact.Severity; import org.sonar.api.issue.impact.SoftwareQuality; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/LoadedActiveRule.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/LoadedActiveRule.java new file mode 100644 index 00000000000..8f2c3643237 --- /dev/null +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/LoadedActiveRule.java @@ -0,0 +1,135 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.scanner.rule; + +import java.util.Map; +import java.util.Set; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.sonar.api.issue.impact.Severity; +import org.sonar.api.issue.impact.SoftwareQuality; +import org.sonar.api.rule.RuleKey; + +public class LoadedActiveRule { + private RuleKey ruleKey; + private String severity; + private Map<SoftwareQuality, Severity> impacts; + private String name; + private String language; + private Map<String, String> params; + private long createdAt; + private long updatedAt; + private String templateRuleKey; + private String internalKey; + private Set<RuleKey> deprecatedKeys; + + public LoadedActiveRule() { + // nothing to do here + } + + public RuleKey getRuleKey() { + return ruleKey; + } + + public void setRuleKey(RuleKey ruleKey) { + this.ruleKey = ruleKey; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSeverity() { + return severity; + } + + public void setSeverity(String severity) { + this.severity = severity; + } + + public Map<SoftwareQuality, Severity> getImpacts() { + return impacts; + } + + public void setImpacts(Map<SoftwareQuality, Severity> impacts) { + this.impacts = impacts; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public Map<String, String> getParams() { + return params; + } + + public void setParams(Map<String, String> params) { + this.params = params; + } + + public long getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(long createdAt) { + this.createdAt = createdAt; + } + + public long getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(long updatedAt) { + this.updatedAt = updatedAt; + } + + @CheckForNull + public String getTemplateRuleKey() { + return templateRuleKey; + } + + public void setTemplateRuleKey(@Nullable String templateRuleKey) { + this.templateRuleKey = templateRuleKey; + } + + public String getInternalKey() { + return internalKey; + } + + public void setInternalKey(String internalKey) { + this.internalKey = internalKey; + } + + public Set<RuleKey> getDeprecatedKeys() { + return deprecatedKeys; + } + + public void setDeprecatedKeys(Set<RuleKey> deprecatedKeys) { + this.deprecatedKeys = deprecatedKeys; + } +} |