chore(sonar)!: cascade CA1822 through Markdown dialect wrappers
SonarQube Analysis / sonarqube (pull_request) Successful in 2m50s
SonarQube Analysis / sonarqube (pull_request) Successful in 2m50s
Commit 5202d93 made the SqlServer-namespaced Markdown generator methods
static, which left the LinqToSql / PostgreSql / Snowflake wrapper
classes' instance methods delegating to nothing but a static call.
SonarQube re-flagged those 10 wrapper methods as CA1822 on the next
scan.
This sweep:
- Makes all 10 wrapper instance methods `static` (`dotnet format` driven).
- Makes `Markdown.LinqToSql.QueryBreakdownGenerator.GenerateCombinedDiagram`
static preemptively — it composes two static helpers and would otherwise
be the next-iteration cascade flag.
- Removes the now-dead `_baseGenerator` field and its initializing
constructor from all six dialect wrappers (LinqToSql / PostgreSql /
Snowflake × QueryBreakdownGenerator + SqlStatementGenerator). The
classes keep their implicit parameterless constructor so `new
Snowflake.QueryBreakdownGenerator()` still compiles.
- Updates the one test call site (`GenerateCombinedDiagram`) the fixer
didn't catch to use type-name form.
BREAKING CHANGE: External NuGet consumers calling
`instance.Generate*Diagram(...)` on `Markdown.LinqToSql.*`,
`Markdown.PostgreSql.*`, or `Markdown.Snowflake.*` generators must
switch to type-name form, e.g. `Markdown.Snowflake.SqlStatementGenerator.GenerateSequenceDiagram(...)`.
The class types and parameterless constructors remain — only the call
syntax for these methods changes.
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
3ba7a7e9f3
commit
6175dcde96
@@ -8,23 +8,13 @@ namespace Strata.SqlTools.Markdown.LinqToSql;
|
||||
/// </summary>
|
||||
public class QueryBreakdownGenerator
|
||||
{
|
||||
private readonly SqlServer.QueryBreakdownGenerator _baseGenerator;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the QueryBreakdownGenerator class.
|
||||
/// </summary>
|
||||
public QueryBreakdownGenerator()
|
||||
{
|
||||
_baseGenerator = new SqlServer.QueryBreakdownGenerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a Mermaid flowchart diagram from a LINQ to SQL QueryBreakdown.
|
||||
/// </summary>
|
||||
/// <param name="queryBreakdown">The LINQ 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(LinqQueryBreakdown queryBreakdown, string? title = null)
|
||||
public static string GenerateMermaidDiagram(LinqQueryBreakdown queryBreakdown, string? title = null)
|
||||
{
|
||||
// Since LinqQueryBreakdown inherits from SqlServer.QueryBreakdown,
|
||||
// we can use the base generator which works with the shared properties
|
||||
@@ -85,7 +75,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 both diagrams.</returns>
|
||||
public string GenerateCombinedDiagram(LinqQueryBreakdown queryBreakdown, string? title = null)
|
||||
public static string GenerateCombinedDiagram(LinqQueryBreakdown queryBreakdown, string? title = null)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder();
|
||||
|
||||
|
||||
@@ -10,23 +10,13 @@ namespace Strata.SqlTools.Markdown.LinqToSql;
|
||||
/// </summary>
|
||||
public class SqlStatementGenerator
|
||||
{
|
||||
private readonly SqlServer.SqlStatementGenerator _baseGenerator;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SqlStatementGenerator class.
|
||||
/// </summary>
|
||||
public SqlStatementGenerator()
|
||||
{
|
||||
_baseGenerator = new SqlServer.SqlStatementGenerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a Mermaid sequence diagram showing LINQ to SQL statement execution flow.
|
||||
/// </summary>
|
||||
/// <param name="sqlBreakdown">The LINQ to SQL breakdown object.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid sequence diagram markdown.</returns>
|
||||
public string GenerateSequenceDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
public static string GenerateSequenceDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
{
|
||||
return SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
}
|
||||
@@ -37,7 +27,7 @@ public class SqlStatementGenerator
|
||||
/// <param name="sqlBreakdown">The SQL breakdown containing query information.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid ER diagram markdown.</returns>
|
||||
public string GenerateEntityRelationshipDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
public static string GenerateEntityRelationshipDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
{
|
||||
//Extract table names from breakdown - just use FROM clause for now
|
||||
var queryBreakdown = sqlBreakdown as IQueryBreakdown;
|
||||
|
||||
@@ -8,23 +8,13 @@ namespace Strata.SqlTools.Markdown.PostgreSql;
|
||||
/// </summary>
|
||||
public class QueryBreakdownGenerator
|
||||
{
|
||||
private readonly SqlServer.QueryBreakdownGenerator _baseGenerator;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the QueryBreakdownGenerator class.
|
||||
/// </summary>
|
||||
public QueryBreakdownGenerator()
|
||||
{
|
||||
_baseGenerator = new SqlServer.QueryBreakdownGenerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a Mermaid flowchart diagram from a PostgreSQL QueryBreakdown.
|
||||
/// </summary>
|
||||
/// <param name="queryBreakdown">The PostgreSQL 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)
|
||||
{
|
||||
// Since PostgreSql.QueryBreakdown inherits from SqlServer.QueryBreakdown,
|
||||
// we can use the base generator which works with the shared properties
|
||||
|
||||
@@ -8,23 +8,13 @@ namespace Strata.SqlTools.Markdown.PostgreSql;
|
||||
/// </summary>
|
||||
public class SqlStatementGenerator
|
||||
{
|
||||
private readonly SqlServer.SqlStatementGenerator _baseGenerator;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SqlStatementGenerator class.
|
||||
/// </summary>
|
||||
public SqlStatementGenerator()
|
||||
{
|
||||
_baseGenerator = new SqlServer.SqlStatementGenerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a Mermaid sequence diagram showing PostgreSQL SQL statement execution flow.
|
||||
/// </summary>
|
||||
/// <param name="sqlBreakdown">The PostgreSQL SQL breakdown object.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid sequence diagram markdown.</returns>
|
||||
public string GenerateSequenceDiagram(SqlBreakdownBase sqlBreakdown, string? title = null)
|
||||
public static string GenerateSequenceDiagram(SqlBreakdownBase sqlBreakdown, string? title = null)
|
||||
{
|
||||
return SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
}
|
||||
@@ -35,7 +25,7 @@ public class SqlStatementGenerator
|
||||
/// <param name="tables">Collection of table names to include in the diagram.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid ER diagram markdown.</returns>
|
||||
public string GenerateEntityRelationshipDiagram(IEnumerable<string> tables, string? title = null)
|
||||
public static string GenerateEntityRelationshipDiagram(IEnumerable<string> tables, string? title = null)
|
||||
{
|
||||
return SqlServer.SqlStatementGenerator.GenerateEntityRelationshipDiagram(tables, title);
|
||||
}
|
||||
|
||||
@@ -8,23 +8,13 @@ namespace Strata.SqlTools.Markdown.Snowflake;
|
||||
/// </summary>
|
||||
public class QueryBreakdownGenerator
|
||||
{
|
||||
private readonly SqlServer.QueryBreakdownGenerator _baseGenerator;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the QueryBreakdownGenerator class.
|
||||
/// </summary>
|
||||
public QueryBreakdownGenerator()
|
||||
{
|
||||
_baseGenerator = new SqlServer.QueryBreakdownGenerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a Mermaid flowchart diagram from a Snowflake QueryBreakdown.
|
||||
/// </summary>
|
||||
/// <param name="queryBreakdown">The Snowflake 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)
|
||||
{
|
||||
// Since Snowflake.QueryBreakdown inherits from SqlServer.QueryBreakdown,
|
||||
// we can use the base generator which works with the shared properties
|
||||
|
||||
@@ -8,23 +8,13 @@ namespace Strata.SqlTools.Markdown.Snowflake;
|
||||
/// </summary>
|
||||
public class SqlStatementGenerator
|
||||
{
|
||||
private readonly SqlServer.SqlStatementGenerator _baseGenerator;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SqlStatementGenerator class.
|
||||
/// </summary>
|
||||
public SqlStatementGenerator()
|
||||
{
|
||||
_baseGenerator = new SqlServer.SqlStatementGenerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a Mermaid sequence diagram showing Snowflake SQL statement execution flow.
|
||||
/// </summary>
|
||||
/// <param name="sqlBreakdown">The Snowflake SQL breakdown object.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid sequence diagram markdown.</returns>
|
||||
public string GenerateSequenceDiagram(SqlBreakdownBase sqlBreakdown, string? title = null)
|
||||
public static string GenerateSequenceDiagram(SqlBreakdownBase sqlBreakdown, string? title = null)
|
||||
{
|
||||
return SqlServer.SqlStatementGenerator.GenerateSequenceDiagram(sqlBreakdown, title);
|
||||
}
|
||||
@@ -35,7 +25,7 @@ public class SqlStatementGenerator
|
||||
/// <param name="tables">Collection of table names to include in the diagram.</param>
|
||||
/// <param name="title">Optional title for the diagram.</param>
|
||||
/// <returns>A string containing the Mermaid ER diagram markdown.</returns>
|
||||
public string GenerateEntityRelationshipDiagram(IEnumerable<string> tables, string? title = null)
|
||||
public static string GenerateEntityRelationshipDiagram(IEnumerable<string> tables, string? title = null)
|
||||
{
|
||||
return SqlServer.SqlStatementGenerator.GenerateEntityRelationshipDiagram(tables, title);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class QueryBreakdownGenerator
|
||||
/// <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 diagram.</returns>
|
||||
public string GenerateMermaidDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
public static string GenerateMermaidDiagram(ISqlBreakdown sqlBreakdown, string? title = null)
|
||||
{
|
||||
// If it's a QueryBreakdown, use the specialized method
|
||||
if (sqlBreakdown is QueryBreakdown qb)
|
||||
|
||||
Reference in New Issue
Block a user