chore(sonar): use LINQ Select for parameter match projection (S3267)

Snowflake/Breakdowns/ProcedureBreakdown.ParseCallParameters — replace the
foreach over a MatchCollection with a .Cast<Match>().Select(m => m.Groups)
projection. The loop now iterates GroupCollection values directly, indexing
groups[1] and groups[2] for name/value without rebinding the Match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-26 09:30:58 -05:00
co-authored by Claude Opus 4.7
parent b6ebb8c7cd
commit 8211047d6b
@@ -235,12 +235,10 @@ public class ProcedureBreakdown : SqlServerProcedureBreakdown
@"(\w+)\s*=>\s*([^,]+)(?:,|$)", @"(\w+)\s*=>\s*([^,]+)(?:,|$)",
System.Text.RegularExpressions.RegexOptions.IgnoreCase, Strata.SqlTools.SqlBreakdown.Utilities.RegexDefaults.MatchTimeout); System.Text.RegularExpressions.RegexOptions.IgnoreCase, Strata.SqlTools.SqlBreakdown.Utilities.RegexDefaults.MatchTimeout);
foreach (System.Text.RegularExpressions.Match paramMatch in paramMatches) foreach (var groups in paramMatches.Cast<System.Text.RegularExpressions.Match>().Select(paramMatch => paramMatch.Groups))
{ {
var paramName = paramMatch.Groups[1].Value.Trim();
var paramValue = paramMatch.Groups[2].Value.Trim();
// Store with @ prefix for consistency with SQL Server // Store with @ prefix for consistency with SQL Server
parameters["@" + paramName] = paramValue; parameters["@" + groups[1].Value.Trim()] = groups[2].Value.Trim();
} }
// If no named parameters found, try positional parameters (just values) // If no named parameters found, try positional parameters (just values)