chore(sonar)!: mark public Markdown generator methods static (CA1822)
SonarQube Analysis / sonarqube (pull_request) Successful in 3m30s
SonarQube Analysis / sonarqube (pull_request) Successful in 3m30s
Three public methods on the SqlServer-namespaced Markdown generators no longer touch instance state and now carry the `static` keyword: - `Markdown.SqlServer.QueryBreakdownGenerator.GenerateMermaidDiagram(QueryBreakdown, string?)` - `Markdown.SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(ISqlBreakdown, string?)` - `Markdown.SqlServer.SqlStatementGenerator.GenerateEntityRelationshipDiagram(IEnumerable<string>, string?)` Plus one private bonus the analyzer caught on the same pass: - `LinqExpressionVisitor.ExtractSelectExpression` → static (non-breaking). Internal callers in the Snowflake/LinqToSql/PostgreSql wrapper classes and in the test fixtures are updated to the type-name form (`SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(...)`). The wrappers retain their `_baseGenerator` field for now even though it is no longer used — that S4487 / unused-field cleanup is its own commit. BREAKING CHANGE: External NuGet consumers calling `generatorInstance.GenerateMermaidDiagram(...)`, `generatorInstance.GenerateSequenceDiagram(...)`, or `generatorInstance.GenerateEntityRelationshipDiagram(...)` on the SqlServer-namespaced generators must switch to type-name form, e.g. `Markdown.SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(...)`. Calls through the Snowflake / LinqToSql / PostgreSql wrapper classes are unaffected at the call site. 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
3c602a4625
commit
5202d93e8e
@@ -277,7 +277,7 @@ public class LinqExpressionVisitor : ExpressionVisitor
|
||||
return base.VisitMember(node);
|
||||
}
|
||||
|
||||
private string ExtractSelectExpression(Expression expression)
|
||||
private static string ExtractSelectExpression(Expression expression)
|
||||
{
|
||||
if (expression is NewExpression newExpr)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ public class QueryBreakdownGenerator
|
||||
{
|
||||
// Since LinqQueryBreakdown inherits from SqlServer.QueryBreakdown,
|
||||
// we can use the base generator which works with the shared properties
|
||||
return _baseGenerator.GenerateMermaidDiagram(queryBreakdown, title);
|
||||
return SqlServer.QueryBreakdownGenerator.GenerateMermaidDiagram(queryBreakdown, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SqlStatementGenerator
|
||||
/// <returns>A string containing the Mermaid sequence diagram markdown.</returns>
|
||||
public string GenerateSequenceDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
{
|
||||
return _baseGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
return SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,7 +49,7 @@ public class SqlStatementGenerator
|
||||
tableNames.Add(fromClauseText);
|
||||
}
|
||||
|
||||
return _baseGenerator.GenerateEntityRelationshipDiagram(tableNames, title);
|
||||
return SqlServer.SqlStatementGenerator.GenerateEntityRelationshipDiagram(tableNames, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -28,6 +28,6 @@ public class QueryBreakdownGenerator
|
||||
{
|
||||
// Since PostgreSql.QueryBreakdown inherits from SqlServer.QueryBreakdown,
|
||||
// we can use the base generator which works with the shared properties
|
||||
return _baseGenerator.GenerateMermaidDiagram(queryBreakdown, title);
|
||||
return SqlServer.QueryBreakdownGenerator.GenerateMermaidDiagram(queryBreakdown, title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SqlStatementGenerator
|
||||
/// <returns>A string containing the Mermaid sequence diagram markdown.</returns>
|
||||
public string GenerateSequenceDiagram(SqlBreakdownBase sqlBreakdown, string? title = null)
|
||||
{
|
||||
return _baseGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
return SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,6 +37,6 @@ public class SqlStatementGenerator
|
||||
/// <returns>A string containing the Mermaid ER diagram markdown.</returns>
|
||||
public string GenerateEntityRelationshipDiagram(IEnumerable<string> tables, string? title = null)
|
||||
{
|
||||
return _baseGenerator.GenerateEntityRelationshipDiagram(tables, title);
|
||||
return SqlServer.SqlStatementGenerator.GenerateEntityRelationshipDiagram(tables, title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ public class QueryBreakdownGenerator
|
||||
{
|
||||
// Since Snowflake.QueryBreakdown inherits from SqlServer.QueryBreakdown,
|
||||
// we can use the base generator which works with the shared properties
|
||||
return _baseGenerator.GenerateMermaidDiagram(queryBreakdown, title);
|
||||
return SqlServer.QueryBreakdownGenerator.GenerateMermaidDiagram(queryBreakdown, title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SqlStatementGenerator
|
||||
/// <returns>A string containing the Mermaid sequence diagram markdown.</returns>
|
||||
public string GenerateSequenceDiagram(SqlBreakdownBase sqlBreakdown, string? title = null)
|
||||
{
|
||||
return _baseGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
return SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,6 +37,6 @@ public class SqlStatementGenerator
|
||||
/// <returns>A string containing the Mermaid ER diagram markdown.</returns>
|
||||
public string GenerateEntityRelationshipDiagram(IEnumerable<string> tables, string? title = null)
|
||||
{
|
||||
return _baseGenerator.GenerateEntityRelationshipDiagram(tables, title);
|
||||
return SqlServer.SqlStatementGenerator.GenerateEntityRelationshipDiagram(tables, title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class QueryBreakdownGenerator
|
||||
/// <param name="queryBreakdown">The QueryBreakdown to visualize.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid markdown diagram.</returns>
|
||||
public string GenerateMermaidDiagram(QueryBreakdown queryBreakdown, string? title = null)
|
||||
public static string GenerateMermaidDiagram(QueryBreakdown queryBreakdown, string? title = null)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class SqlStatementGenerator
|
||||
/// <param name="sqlBreakdown">The SQL breakdown to visualize.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid markdown sequence diagram.</returns>
|
||||
public string GenerateSequenceDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
public static string GenerateSequenceDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SqlStatementGenerator
|
||||
/// <param name="tableNames">List of table names referenced in the query.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid markdown ER diagram.</returns>
|
||||
public string GenerateEntityRelationshipDiagram(IEnumerable<string> tableNames, string? title = null)
|
||||
public static string GenerateEntityRelationshipDiagram(IEnumerable<string> tableNames, string? title = null)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user