From 1f252e39aa21cf257ca944b63328b8de888ab8eb Mon Sep 17 00:00:00 2001 From: Steffen Wilke Date: Tue, 9 Jun 2020 09:44:39 +0200 Subject: [PATCH] Replace "," with "_" in rule key. Closes #7 --- .../resharper/clt/models/InspectCodeIssueDefinitionModel.java | 2 +- .../plugin/resharper/clt/models/InspectCodeIssueModel.java | 2 +- .../resharper/clt/models/SonarQubeRuleDefinitionModel.java | 4 ++-- .../plugin/resharper/clt/xml/InspectCodeXmlFileParser.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueDefinitionModel.java b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueDefinitionModel.java index 8db6125..3056b33 100644 --- a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueDefinitionModel.java +++ b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueDefinitionModel.java @@ -63,7 +63,7 @@ public class InspectCodeIssueDefinitionModel { * The unique identifier of this issue as defined by {@code InspectCode}. */ public InspectCodeIssueDefinitionModel(@NotNull String issueTypeId) { - this.issueTypeId = issueTypeId.trim(); + this.issueTypeId = issueTypeId.replace(',', '_').trim(); } /** diff --git a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueModel.java b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueModel.java index 3e194fa..f610db2 100644 --- a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueModel.java +++ b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/InspectCodeIssueModel.java @@ -57,7 +57,7 @@ public String getIssueTypeId() { * The issue type identifier, which should correspond to {@link InspectCodeIssueDefinitionModel#getIssueTypeId()}. */ public void setIssueTypeId(String issueTypeId) { - this.issueTypeId = issueTypeId; + this.issueTypeId = issueTypeId.replace(',', '_').trim(); } /** diff --git a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/SonarQubeRuleDefinitionModel.java b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/SonarQubeRuleDefinitionModel.java index 781cc1e..0f16a8b 100644 --- a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/SonarQubeRuleDefinitionModel.java +++ b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/models/SonarQubeRuleDefinitionModel.java @@ -70,12 +70,12 @@ public final class SonarQubeRuleDefinitionModel { * are removed from the supplied value. Must not be {@code null}. */ public SonarQubeRuleDefinitionModel(@NotNull String ruleDefinitionKey) { - this.ruleDefinitionKey = ruleDefinitionKey.trim(); + this.ruleDefinitionKey = ruleDefinitionKey.replace(',', '_').trim(); } public SonarQubeRuleDefinitionModel(@NotNull InspectCodeIssueDefinitionModel model){ + this(model.getIssueTypeId()); this.inspectcodeModel = model; - this.ruleDefinitionKey = model.getIssueTypeId(); this.ruleName = model.getDescription(); this.activatedByDefault = false; this.ruleStatus = RuleStatus.READY; diff --git a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/xml/InspectCodeXmlFileParser.java b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/xml/InspectCodeXmlFileParser.java index b410e09..2586586 100644 --- a/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/xml/InspectCodeXmlFileParser.java +++ b/src/main/java/com/soloplan/oss/sonarqube/plugin/resharper/clt/xml/InspectCodeXmlFileParser.java @@ -544,7 +544,7 @@ private InspectCodeIssueDefinitionModel parseXmlElementIssueType(@NotNull final // Create a new issue definition model instance final InspectCodeIssueDefinitionModel inspectCodeIssueDefinitionModel = - new InspectCodeIssueDefinitionModel(ruleDefinitionIdentifier.trim()); + new InspectCodeIssueDefinitionModel(ruleDefinitionIdentifier); // Parse all attributes of the XML element that just started final int length = attributes.getLength();