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:
co-authored by
Claude Opus 4.7
parent
84b06557e5
commit
f5d539b906
@@ -98,6 +98,8 @@ public class QueryBreakdownTests
|
||||
Assert.That(sql, Does.Contain("ORDER BY"));
|
||||
}
|
||||
|
||||
private static readonly char[] separator = new[] { '\r', '\n' };
|
||||
|
||||
[Test]
|
||||
public void GetSql_WithSingleWithClause_UsesSnowflakeIndentation()
|
||||
{
|
||||
@@ -114,7 +116,7 @@ public class QueryBreakdownTests
|
||||
Assert.That(sql, Does.Contain("WITH"));
|
||||
Assert.That(sql, Does.Contain("PRODUCT_SUMMARY AS ("));
|
||||
// Verify 4-space Snowflake indentation
|
||||
var lines = sql.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var lines = sql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
var indentedLines = lines.Where(l => l.StartsWith(" ")).ToList();
|
||||
Assert.That(indentedLines.Count, Is.GreaterThan(0));
|
||||
}
|
||||
@@ -1118,7 +1120,7 @@ public class QueryBreakdownTests
|
||||
_ = baseQueryBreakdown.GetSql();
|
||||
|
||||
// Assert - Snowflake should use 4-space indent, base uses 5-space
|
||||
var snowflakeLines = snowflakeSql.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var snowflakeLines = snowflakeSql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
var snowflakeIndentedLines = snowflakeLines.Where(l => l.StartsWith(" ") && !l.StartsWith(" ")).ToList();
|
||||
Assert.That(snowflakeIndentedLines.Count, Is.GreaterThan(0), "Snowflake should use 4-space indentation");
|
||||
}
|
||||
@@ -1322,7 +1324,7 @@ public class QueryBreakdownTests
|
||||
Assert.That(snowflakeSql, Does.Contain("WHERE"));
|
||||
Assert.That(snowflakeSql, Does.Contain("ORDER BY"));
|
||||
// Verify Snowflake-style formatting (4-space indentation)
|
||||
var lines = snowflakeSql.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var lines = snowflakeSql.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||
var indentedLines = lines.Where(l => l.StartsWith(" ")).ToList();
|
||||
Assert.That(indentedLines.Count, Is.GreaterThan(0), "Should have Snowflake-style indentation");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user