chore(sonar): hoist constant array literals to static readonly fields (CA1861)

Applied via `dotnet format analyzers --diagnostics CA1861 --severity info`,
plus manual cleanup:

- Renamed two cryptic fixer-generated field names:
  - QueryBreakdownCollection.stringArray -> SnowflakeFunctionNames (and
    inlined the now-redundant local alias)
  - ExpressionObjectTests.arg2 -> NotInValues
- Deduped three identical `separator = ['\r','\n']` fields the fixer
  emitted in the same test class (kept the first declaration; the other
  two test methods now reuse it).

8 files touched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-26 15:45:16 -05:00
co-authored by Claude Opus 4.7
parent 84b06557e5
commit f5d539b906
8 changed files with 30 additions and 20 deletions
@@ -5,6 +5,8 @@ namespace Strata.SqlTools.SqlBreakdown.Tests.ExpressionTests;
[TestFixture]
public class ExpressionFactoryFilterTests : ExpressionTestsBase
{
private static readonly string[] values = new[] { "FY2019", "FY2020", "FY2021", "FY2022" };
private static IEnumerable<TestCaseData> FilterTestCases()
{
var dischargeDate = DateTime.Now.Date.AddMonths(1);
@@ -16,7 +18,7 @@ public class ExpressionFactoryFilterTests : ExpressionTestsBase
).SetName("ListFilterContinuous_{m}");
yield return new TestCaseData(
new Filter(4, FilterType.List, new[] { "FY2019", "FY2020", "FY2021", "FY2022" }, Array.Empty<FilterCondition>(), DatePart.FiscalYear, false, 0, 0),
new Filter(4, FilterType.List, values, Array.Empty<FilterCondition>(), DatePart.FiscalYear, false, 0, 0),
"(DEPT.DISCHARGE_DATE >= '2018-07-01' AND DEPT.DISCHARGE_DATE < '2019-07-01') OR \n(DEPT.DISCHARGE_DATE >= '2019-07-01' AND DEPT.DISCHARGE_DATE < '2020-07-01') OR \n(DEPT.DISCHARGE_DATE >= '2020-07-01' AND DEPT.DISCHARGE_DATE < '2021-07-01') OR \n(DEPT.DISCHARGE_DATE >= '2021-07-01' AND DEPT.DISCHARGE_DATE < '2022-07-01')"
).SetName("DateListFilterFiscalYear_{m}");
@@ -29,6 +29,8 @@ public class ExpressionObjectTests : ExpressionTestsBase
Assert.That(paramExp.ParameterName, Is.EqualTo("MY_PARAM"));
}
private static readonly string[] NotInValues = new[] { "value1", "value2", "value3" };
private static IEnumerable<TestCaseData> ComparisonExpressionTestCases()
{
yield return new TestCaseData("GreaterThanOrEqual", 250, typeof(GreaterThanOrEqualToExpression))
@@ -40,7 +42,7 @@ public class ExpressionObjectTests : ExpressionTestsBase
yield return new TestCaseData("Equals", "TestDept", typeof(EqualToExpression))
.SetName("Equals_{m}");
yield return new TestCaseData("NotIn", new[] { "value1", "value2", "value3" }, typeof(NotInExpression))
yield return new TestCaseData("NotIn", NotInValues, typeof(NotInExpression))
.SetName("NotIn_{m}");
yield return new TestCaseData("Like", "%pattern%", typeof(LikeExpression))