chore(sonar): mechanical src/ cleanups — AsSpan, drop ContainsKey guard, simplify GetQuery (CA1846, CA1853, S2219)
- `SqlParseException.cs:90` (CA1846): `sql.Substring(0, 197)` → `sql.AsSpan(0, 197)` in the truncated-SQL diagnostic message. Avoids an allocation in an already cold exception path. - `Snowflake/QueryBreakdown.cs:103` (CA1853): drop the redundant `Parameters.ContainsKey(...)` guard around `Parameters.Remove(...)`. `Dictionary<TKey,TValue>.Remove` is a no-op if the key is absent, so the guard only doubled the work and computed the key string twice. - `LinqQueryBreakdown.cs:194` (S2219): collapse the now-stub `GetQuery<T>()` (every branch returned `GetEmptyQueryable<T>()` after the S1168 cleanup) to a single expression-bodied member. Updates the XML doc to describe the actual current behavior. 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
cbe891dc0b
commit
1bd6deec83
@@ -100,10 +100,7 @@ public class QueryBreakdown : SqlServerQueryBreakdown
|
||||
base.AddParameter(colonName.TrimStart(':', '@'), value);
|
||||
|
||||
// Add both formats to dictionary for compatibility
|
||||
if (Parameters.ContainsKey($"@{colonName.TrimStart(':', '@')}"))
|
||||
{
|
||||
Parameters.Remove($"@{colonName.TrimStart(':', '@')}");
|
||||
}
|
||||
Parameters.Remove($"@{colonName.TrimStart(':', '@')}");
|
||||
Parameters[colonName] = value;
|
||||
Parameters[atName] = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user