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
@@ -113,10 +113,10 @@ public class QueryBreakdownEntity
|
||||
/// <summary>
|
||||
/// Navigation property for the related query parameters.
|
||||
/// </summary>
|
||||
public virtual ICollection<QueryParameterEntity> Parameters { get; set; } = new List<QueryParameterEntity>();
|
||||
public virtual ICollection<QueryParameterEntity> Parameters { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Navigation property for the related WITH clauses (CTEs).
|
||||
/// </summary>
|
||||
public virtual ICollection<WithClauseEntity> WithClauses { get; set; } = new List<WithClauseEntity>();
|
||||
public virtual ICollection<WithClauseEntity> WithClauses { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public class QueryBreakdownMapper : IQueryBreakdownMapper
|
||||
|
||||
internal static List<string> DeserializeList(string json)
|
||||
{
|
||||
return JsonSerializer.Deserialize<List<string>>(json) ?? new List<string>();
|
||||
return JsonSerializer.Deserialize<List<string>>(json) ?? [];
|
||||
}
|
||||
|
||||
internal static string SerializeArrayList(ArrayList list)
|
||||
@@ -241,7 +241,7 @@ public class QueryBreakdownMapper : IQueryBreakdownMapper
|
||||
|
||||
internal static ArrayList DeserializeArrayList(string json)
|
||||
{
|
||||
var stringList = JsonSerializer.Deserialize<List<string>>(json) ?? new List<string>();
|
||||
var stringList = JsonSerializer.Deserialize<List<string>>(json) ?? [];
|
||||
var arrayList = new ArrayList();
|
||||
foreach (var item in stringList)
|
||||
{
|
||||
@@ -262,7 +262,7 @@ public class QueryBreakdownMapper : IQueryBreakdownMapper
|
||||
|
||||
internal static Dictionary<string, object> DeserializeDictionary(string json)
|
||||
{
|
||||
var stringDict = JsonSerializer.Deserialize<Dictionary<string, string>>(json) ?? new Dictionary<string, string>();
|
||||
var stringDict = JsonSerializer.Deserialize<Dictionary<string, string>>(json) ?? [];
|
||||
var result = new Dictionary<string, object>();
|
||||
foreach (var kvp in stringDict)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user