chore(sonar): apply collection-expression syntax across all sites (IDE0028)
SonarQube Analysis / sonarqube (pull_request) Successful in 2m47s
SonarQube Analysis / sonarqube (pull_request) Successful in 2m47s
Manual sweep of all 42 IDE0028 sites flagged by SonarQube — `dotnet format
analyzers --diagnostics IDE0028` declined to fix these (no .editorconfig
opt-in for `dotnet_style_prefer_collection_expression`), so applied by
hand. The repo already targets `<LangVersion>latest</LangVersion>` on
net8.0, so C# 12 collection expressions are available.
Pattern: `new List<T>()` / `new Dictionary<K,V>()` / `new ArrayList()` /
`new()` -> `[]` for empty; `new List<T> { ... }` -> `[...]` for literal.
24 files touched in src/{EFCore, LinqToSql, Query, Snowflake, SqlBreakdown,
SqlServer}; tests untouched (no IDE0028 sites in test code).
Build clean (35 warnings unchanged from baseline, 0 errors). All tests
remain green.
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
c38d122d76
commit
0f8d505616
@@ -20,7 +20,7 @@ public class RawSqlBreakdown : ISqlBreakdown
|
||||
/// <summary>
|
||||
/// Gets or sets the setup clauses to execute before the main statement.
|
||||
/// </summary>
|
||||
public List<string> SetupClauses { get; set; } = new List<string>();
|
||||
public List<string> SetupClauses { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether setup clauses are being used.
|
||||
@@ -30,7 +30,7 @@ public class RawSqlBreakdown : ISqlBreakdown
|
||||
/// <summary>
|
||||
/// Gets or sets the finish clauses to execute after the main statement.
|
||||
/// </summary>
|
||||
public ArrayList FinishClauses { get; set; } = new ArrayList();
|
||||
public ArrayList FinishClauses { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether finish clauses are being used.
|
||||
|
||||
@@ -14,8 +14,8 @@ public abstract class SqlBreakdownBase : ISqlBreakdown
|
||||
/// </summary>
|
||||
protected SqlBreakdownBase()
|
||||
{
|
||||
SetupClauses = new List<string>();
|
||||
FinishClauses = new ArrayList();
|
||||
SetupClauses = [];
|
||||
FinishClauses = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SqlBreakdownCollection : ICollection<ISqlBreakdown>
|
||||
/// </summary>
|
||||
public SqlBreakdownCollection()
|
||||
{
|
||||
_breakdowns = new List<ISqlBreakdown>();
|
||||
_breakdowns = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -18,7 +18,7 @@ public class SqlFilter : ISqlAppendable
|
||||
public SqlFilter()
|
||||
{
|
||||
_sqlExpression = new StringBuilder();
|
||||
_parameterValues = new Dictionary<string, object>();
|
||||
_parameterValues = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -29,7 +29,7 @@ public class SqlFilter : ISqlAppendable
|
||||
public SqlFilter(string expression, params object[] parameterNameValue)
|
||||
{
|
||||
_sqlExpression = new StringBuilder(expression);
|
||||
_parameterValues = new Dictionary<string, object>();
|
||||
_parameterValues = [];
|
||||
|
||||
if (parameterNameValue.Length % 2 != 0)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ public class SqlFilter : ISqlAppendable
|
||||
public SqlFilter(SqlFilter filter)
|
||||
{
|
||||
_sqlExpression = new StringBuilder(filter.SqlExpression);
|
||||
_parameterValues = new Dictionary<string, object>();
|
||||
_parameterValues = [];
|
||||
|
||||
foreach (var key in filter.ParameterValues.Keys)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public class SqlFrom
|
||||
public SqlFrom(string tableExpression, string tableAlias)
|
||||
{
|
||||
_firstTable = new SqlTable(tableExpression, tableAlias);
|
||||
_joins = new List<SqlJoin>();
|
||||
_joins = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user