chore(sonar)!: mark instance-data-free members static (CA1822)
Applied via `dotnet format analyzers --diagnostics CA1822 --severity info`. 12 files touched. The fixer also updated internal callers in tests to use the type-name form (e.g. `gen.Method(x)` -> `Generator.Method(x)`); build and full test suite remain green. BREAKING CHANGE: two public methods become static and therefore can no longer be invoked through an instance reference by external consumers: - Strata.SqlTools.Markdown.LinqToSql.QueryBreakdownGenerator.GenerateMethodChainDiagram - Strata.SqlTools.Markdown.LinqToSql.SqlStatementGenerator.GenerateLinqPipelineDiagram Both are stateless utility methods on Generator classes — the static form is the correct shape; the only callers in this repo already used the type-name form. External code should change `gen.GenerateMethodChainDiagram(...)` to `QueryBreakdownGenerator.GenerateMethodChainDiagram(...)`. All other CA1822 hits in this commit are on private/protected members (no public-surface impact). 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
8b7fc1a327
commit
84b06557e5
@@ -222,7 +222,7 @@ public class QueryValidator
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateWhereClause(LinqQueryBreakdown breakdown)
|
||||
private static void ValidateWhereClause(LinqQueryBreakdown breakdown)
|
||||
{
|
||||
// No validation needed - WHERE is optional
|
||||
}
|
||||
@@ -242,12 +242,12 @@ public class QueryValidator
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateHavingClause(LinqQueryBreakdown breakdown)
|
||||
private static void ValidateHavingClause(LinqQueryBreakdown breakdown)
|
||||
{
|
||||
// Validation delegated to ValidateGroupByClause
|
||||
}
|
||||
|
||||
private void ValidateOrderByClause(LinqQueryBreakdown breakdown)
|
||||
private static void ValidateOrderByClause(LinqQueryBreakdown breakdown)
|
||||
{
|
||||
// No validation needed - ORDER BY is optional
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ public class LinqExpressionVisitor : ExpressionVisitor
|
||||
return expression.ToString();
|
||||
}
|
||||
|
||||
private string GetFullMemberName(MemberExpression expression)
|
||||
private static string GetFullMemberName(MemberExpression expression)
|
||||
{
|
||||
var parts = new Stack<string>();
|
||||
var current = expression;
|
||||
@@ -354,7 +354,7 @@ public class LinqExpressionVisitor : ExpressionVisitor
|
||||
return string.Join(".", parts);
|
||||
}
|
||||
|
||||
private string GetOperator(ExpressionType nodeType)
|
||||
private static string GetOperator(ExpressionType nodeType)
|
||||
{
|
||||
return nodeType switch
|
||||
{
|
||||
|
||||
@@ -260,7 +260,7 @@ public class ExpressionGenerator : IVisitor<string>
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private int GenerateMermaidNodes(Expression expression, StringBuilder sb, Dictionary<object, int> nodeMap, ref int nodeCounter)
|
||||
private static int GenerateMermaidNodes(Expression expression, StringBuilder sb, Dictionary<object, int> nodeMap, ref int nodeCounter)
|
||||
{
|
||||
var currentNode = nodeCounter++;
|
||||
nodeMap[expression] = currentNode;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class SimpleExpressionGenerator
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private string GetExpressionDescription(Expression expression)
|
||||
private static string GetExpressionDescription(Expression expression)
|
||||
{
|
||||
var typeName = expression.GetType().Name;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class QueryBreakdownGenerator
|
||||
/// <param name="queryBreakdown">The LINQ QueryBreakdown to visualize.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid flowchart showing method calls.</returns>
|
||||
public string GenerateMethodChainDiagram(LinqQueryBreakdown queryBreakdown, string? title = null)
|
||||
public static string GenerateMethodChainDiagram(LinqQueryBreakdown queryBreakdown, string? title = null)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SqlStatementGenerator
|
||||
/// <param name="queryBreakdown">The query breakdown containing query information.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid diagram markdown.</returns>
|
||||
public string GenerateLinqPipelineDiagram(IQueryBreakdown queryBreakdown, string? title = null)
|
||||
public static string GenerateLinqPipelineDiagram(IQueryBreakdown queryBreakdown, string? title = null)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder();
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class QueryBreakdownGenerator
|
||||
/// <summary>
|
||||
/// Escapes text for Mermaid diagram labels to prevent syntax errors.
|
||||
/// </summary>
|
||||
private string EscapeMermaidText(string text)
|
||||
private static string EscapeMermaidText(string text)
|
||||
{
|
||||
return text
|
||||
.Replace("\"", """)
|
||||
@@ -194,7 +194,7 @@ public class QueryBreakdownGenerator
|
||||
/// <summary>
|
||||
/// Truncates text to a maximum length and adds ellipsis if needed.
|
||||
/// </summary>
|
||||
private string TruncateText(string text, int maxLength)
|
||||
private static string TruncateText(string text, int maxLength)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text) || text.Length <= maxLength)
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ public class SqlStatementGenerator
|
||||
/// <summary>
|
||||
/// Escapes text for Mermaid diagram labels.
|
||||
/// </summary>
|
||||
private string EscapeMermaidText(string text)
|
||||
private static string EscapeMermaidText(string text)
|
||||
{
|
||||
return text
|
||||
.Replace("\"", """)
|
||||
@@ -115,7 +115,7 @@ public class SqlStatementGenerator
|
||||
/// <summary>
|
||||
/// Truncates text to a maximum length.
|
||||
/// </summary>
|
||||
private string TruncateText(string text, int maxLength)
|
||||
private static string TruncateText(string text, int maxLength)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text) || text.Length <= maxLength)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public class SqlStatementGenerator
|
||||
/// <summary>
|
||||
/// Cleans table name for use in Mermaid diagrams.
|
||||
/// </summary>
|
||||
private string CleanTableName(string tableName)
|
||||
private static string CleanTableName(string tableName)
|
||||
{
|
||||
return tableName
|
||||
.Replace("[", "")
|
||||
|
||||
Reference in New Issue
Block a user