From 18899bae70de511497ea2e56208efa33035be461 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Tue, 7 Mar 2023 08:31:22 -0700 Subject: [PATCH] editorconfig bugs --- Adaptation/.editorconfig | 4 +++- Adaptation/FileHandlers/OpenInsight/FromIQS.cs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Adaptation/.editorconfig b/Adaptation/.editorconfig index b84fca4..1e59ffa 100644 --- a/Adaptation/.editorconfig +++ b/Adaptation/.editorconfig @@ -79,9 +79,11 @@ dotnet_code_quality.CAXXXX.api_surface = private, internal dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable +dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer AsSpan over Substring +dotnet_diagnostic.CA1847.severity = none # CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name -dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant. dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2"); +dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant. dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049) diff --git a/Adaptation/FileHandlers/OpenInsight/FromIQS.cs b/Adaptation/FileHandlers/OpenInsight/FromIQS.cs index 93aaf92..2c7caaf 100644 --- a/Adaptation/FileHandlers/OpenInsight/FromIQS.cs +++ b/Adaptation/FileHandlers/OpenInsight/FromIQS.cs @@ -146,7 +146,7 @@ public class FromIQS }; string[] pair; string[] segments; - foreach (string line in logisticLines.Split(Environment.NewLine)) + foreach (string line in logisticLines.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) { segments = line.Split('\t'); if (segments.Length < 2) @@ -158,7 +158,7 @@ public class FromIQS pair = segment.Split('='); if (pair.Length != 2 || pair[0].Length < 3) continue; - _ = stringBuilder.Append('"').Append(pair[0][2..]).Append('"').Append(':').Append('"').Append(pair[1]).Append('"').Append(','); + _ = stringBuilder.Append('"').Append(pair[0].Substring(2)).Append('"').Append(':').Append('"').Append(pair[1]).Append('"').Append(','); } if (stringBuilder.Length > 0) _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); @@ -169,7 +169,7 @@ public class FromIQS _ = stringBuilder.Append(']').Append('}'); _ = stringBuilder.Insert(0, ",\"Logistics\":["); string json = JsonSerializer.Serialize(@object); - _ = stringBuilder.Insert(0, json[..^1]); + _ = stringBuilder.Insert(0, json.Substring(0, json.Length - 1)); JsonElement? jsonElement = JsonSerializer.Deserialize(stringBuilder.ToString()); result = jsonElement is null ? "{}" : JsonSerializer.Serialize(jsonElement, new JsonSerializerOptions { WriteIndented = true }); return result;