chore(sonar): use concrete return types where binary-safe (CA1859)

CA1859 has no `dotnet format` batch fixer, so applied manually after
verifying each site is private/internal/test (no public-surface impact):

- Markdown.TryParseLogicalOperation: Expression? -> BoolExpr?  (private)
- Markdown.TryParseComparison:       Expression? -> Comparison? (private)
- RuleSet.GetAllSingleRules(IGroup): IEnumerable<SingleRule> -> List<SingleRule> (private overload)
- SqlExpressionClause.SplitOnComma:  IEnumerable<string> -> List<string> (private)
- QueryBreakdownRepositoryTests._repository: IQueryBreakdownRepository -> QueryBreakdownRepository (test private field)
- UnitTest1.StartsWith(...,string):  Expression -> MethodCallExpression (test private helper)

The public `RuleSet.GetAllSingleRules()` overload still returns
IEnumerable<SingleRule> — only the private recursive helper was tightened.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-26 15:49:20 -05:00
co-authored by Claude Opus 4.7
parent 81254c12f9
commit 6af239035b
5 changed files with 6 additions and 6 deletions
@@ -115,7 +115,7 @@ public static class Markdown
return ParseAtomicExpression(text);
}
private static Expression? TryParseLogicalOperation(string text)
private static BoolExpr? TryParseLogicalOperation(string text)
{
foreach (var op in LogicalOperators.Keys)
{
@@ -130,7 +130,7 @@ public static class Markdown
return null;
}
private static Expression? TryParseComparison(string text)
private static Comparison? TryParseComparison(string text)
{
foreach (var op in ComparisonOperators.Keys)
{
+1 -1
View File
@@ -50,7 +50,7 @@ public class RuleSet : IGroup
/// </summary>
/// <param name="group">The rule group to traverse.</param>
/// <returns>An enumerable of all single rules found in the group.</returns>
private static IEnumerable<SingleRule> GetAllSingleRules(IGroup group)
private static List<SingleRule> GetAllSingleRules(IGroup group)
{
var rules = new List<SingleRule>();
foreach (var rule in group.Rules)
@@ -85,7 +85,7 @@ public class SqlExpressionClause : SqlClause, ISqlExpressionClause
/// </summary>
/// <param name="clause">The clause to split.</param>
/// <returns>An enumerable collection of individual items.</returns>
private static IEnumerable<string> SplitOnComma(string clause)
private static List<string> SplitOnComma(string clause)
{
var items = new List<string>();
var current = new StringBuilder();
@@ -11,7 +11,7 @@ public class QueryBreakdownRepositoryTests
{
private DbContext _dbContext = null!;
private IQueryBreakdownMapper _mapper = null!;
private IQueryBreakdownRepository _repository = null!;
private QueryBreakdownRepository _repository = null!;
[SetUp]
public void Setup()
@@ -148,7 +148,7 @@ public class Tests
return result;
}
static System.Linq.Expressions.Expression StartsWith(System.Linq.Expressions.Expression expression, string value)
static MethodCallExpression StartsWith(System.Linq.Expressions.Expression expression, string value)
{
return StartsWith(expression, LinqExpression.Constant(value));
}