chore(sonar): bulk-fix mechanical CA/IDE analyzer warnings
Applied via `dotnet format analyzers --diagnostics IDE0028 CA1825 CA1834
CA1845 CA1847 CA1860 CA1866 CA1853 CA1830 CA1846 CA1806 CA1869 CA2249
--severity info`. 19 files touched, all mechanical syntactic rewrites:
- CA1847: string.Contains("x") -> string.Contains('x')
- CA2249: s.IndexOf(c) == -1 -> !s.Contains(c)
- CA1830: sb.Append(sb.ToString()) -> sb.Append(sb)
- CA1834: StringBuilder.Append("x") -> Append('x')
- CA1825, CA1860, CA1866, CA1853, IDE0028, CA1845: corresponding fixers
Three rules in the batch had no batch fixer available (CA1846 ×4,
CA1806 ×1, CA1869 ×1) and stay open for separate manual handling.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
3010019dc5
commit
2c2a8b1193
@@ -41,7 +41,7 @@ public static class GuidUtils
|
||||
return Guid.Empty;
|
||||
}
|
||||
|
||||
if (value.Contains("-"))
|
||||
if (value.Contains('-'))
|
||||
{
|
||||
// This function was called on an already valid guid
|
||||
return new Guid(value);
|
||||
@@ -92,7 +92,7 @@ public static class GuidUtils
|
||||
var sb = new System.Text.StringBuilder(newguid);
|
||||
while (sb.Length < Guid.Empty.ToString().Length)
|
||||
{
|
||||
sb.Append(sb.ToString());
|
||||
sb.Append(sb);
|
||||
}
|
||||
newguid = sb.ToString();
|
||||
|
||||
@@ -114,7 +114,7 @@ public static class GuidUtils
|
||||
for (int i = 0; i < guidChars.Length; i++)
|
||||
{
|
||||
char chr = guidChars[i];
|
||||
if (valid.IndexOf(chr) == -1 && !((chr == '-') && (i == 8 || i == 13 || i == 18 || i == 23)))
|
||||
if (!valid.Contains(chr) && !((chr == '-') && (i == 8 || i == 13 || i == 18 || i == 23)))
|
||||
{
|
||||
guidChars[i] = valid[Math.Abs(StringUtils.GetHashCode32Bit(chr)) % valid.Length];
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public static partial class SqlUtils
|
||||
public static void AppendAliasColumnWithComma(StringBuilder stringBuilder, string alias, string columnName)
|
||||
{
|
||||
stringBuilder.Append(alias);
|
||||
stringBuilder.Append(".");
|
||||
stringBuilder.Append('.');
|
||||
stringBuilder.Append(columnName);
|
||||
stringBuilder.AppendLine(",");
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public static partial class SqlUtils
|
||||
{
|
||||
stringBuilder.Append("CAST(");
|
||||
stringBuilder.Append(alias);
|
||||
stringBuilder.Append(".");
|
||||
stringBuilder.Append('.');
|
||||
stringBuilder.Append(columnName);
|
||||
stringBuilder.Append(" AS ");
|
||||
stringBuilder.Append(dataType);
|
||||
@@ -94,7 +94,7 @@ public static partial class SqlUtils
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
sb.Append(",");
|
||||
sb.Append(',');
|
||||
}
|
||||
|
||||
string trimmed = columnNames[i].Trim();
|
||||
|
||||
@@ -42,10 +42,10 @@ public static partial class SqlUtils
|
||||
|
||||
foreach (Guid g in guidList)
|
||||
{
|
||||
sb.Append("'");
|
||||
sb.Append('\'');
|
||||
sb.Append(g.ToString());
|
||||
sb.Append("'");
|
||||
sb.Append(",");
|
||||
sb.Append('\'');
|
||||
sb.Append(',');
|
||||
}
|
||||
|
||||
return sb.ToString().Trim().TrimEnd(',');
|
||||
|
||||
@@ -27,7 +27,7 @@ public static partial class SqlUtils
|
||||
double.TryParse(value, out double dblValue);
|
||||
|
||||
// Optimize IN if only one value
|
||||
if (operation == FilterOperation.In && !value.Contains(","))
|
||||
if (operation == FilterOperation.In && !value.Contains(','))
|
||||
{
|
||||
operation = FilterOperation.Equal;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public static partial class SqlUtils
|
||||
}
|
||||
|
||||
int lastCloseParen = sb.ToString().LastIndexOf(')');
|
||||
filter.SqlExpression = sb.ToString().Substring(0, lastCloseParen + 1) + ")";
|
||||
filter.SqlExpression = string.Concat(sb.ToString().AsSpan(0, lastCloseParen + 1), ")");
|
||||
break;
|
||||
|
||||
case FilterOperation.NotBetween:
|
||||
|
||||
Reference in New Issue
Block a user