chore(sonar)!: production-code cleanup — S1168 GetQuery + CA1822 static methods #15

Merged
bermudalamb merged 5 commits from fix/sonarqube-prod-s1168-ca1822 into main 2026-05-27 14:54:06 -05:00
Showing only changes of commit 3ba7a7e9f3 - Show all commits
@@ -1,5 +1,5 @@
using System.Linq.Expressions;
using Strata.SqlTools.Breakdowns.SqlServer;
using System.Linq.Expressions;
using PostgreSqlBreakdown = Strata.SqlTools.Breakdowns.PostgreSql.QueryBreakdown;
using SnowflakeBreakdown = Strata.SqlTools.Breakdowns.Snowflake.QueryBreakdown;
@@ -195,24 +195,32 @@ public class LinqQueryBreakdown : QueryBreakdown
{
if (OriginalExpression == null)
{
return Enumerable.Empty<T>().AsQueryable();
return GetEmptyQueryable<T>();
}
try
{
if (OriginalExpression is Expression && EntityType == typeof(T))
{
return Enumerable.Empty<T>().AsQueryable();
return GetEmptyQueryable<T>();
}
return Enumerable.Empty<T>().AsQueryable();
return GetEmptyQueryable<T>();
}
catch
{
return Enumerable.Empty<T>().AsQueryable();
return GetEmptyQueryable<T>();
}
}
/// <summary>
/// Get and empty queryable of T
/// </summary>
/// <typeparam name="T">The entity type for the query.</typeparam>
/// <returns>An empty IQueryable of the type.</returns>
public static IQueryable<T> GetEmptyQueryable<T>() where T : class
=> Enumerable.Empty<T>().AsQueryable();
/// <summary>
/// Analyzes an INSERT operation for the given entity.
/// </summary>