chore(sonar)!: mark Markdown generator classes as 'public static class' (S1118)
SonarQube Analysis / sonarqube (pull_request) Successful in 4m22s

After the CA1822 cascade in #15 left every method on the eight
Markdown generator classes static, the classes themselves were
instantiable shells that consumers couldn't usefully `new`. This
commit flips the `class` modifier to `static class` on all eight:

- `Markdown.SqlServer.QueryBreakdownGenerator`
- `Markdown.SqlServer.SqlStatementGenerator`
- `Markdown.LinqToSql.QueryBreakdownGenerator`
- `Markdown.LinqToSql.SqlStatementGenerator`
- `Markdown.PostgreSql.QueryBreakdownGenerator`
- `Markdown.PostgreSql.SqlStatementGenerator`
- `Markdown.Snowflake.QueryBreakdownGenerator`
- `Markdown.Snowflake.SqlStatementGenerator`

Test fixtures drop the now-meaningless `_generator = new …()` field
and `[SetUp]` (kept the existing Setup body where unrelated state was
also initialized — `QueryMarkdownGenerationTests` and
`LinqToSql.QueryBreakdownGeneratorTests`).

BREAKING CHANGE: External NuGet consumers can no longer write
`new Markdown.Snowflake.SqlStatementGenerator()` (or any of the other
seven classes above) — the type is now a static container and may only
be referenced by name, e.g.
`Markdown.Snowflake.SqlStatementGenerator.GenerateSequenceDiagram(…)`.
The call syntax for the static methods is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-27 15:08:48 -05:00
co-authored by Claude Opus 4.7
parent 54b9c7876f
commit 423108a7dc
17 changed files with 8 additions and 69 deletions
@@ -6,7 +6,7 @@ namespace Strata.SqlTools.Markdown.LinqToSql;
/// Generates Mermaid diagram markdown from LINQ to SQL QueryBreakdown objects.
/// Creates flowchart visualizations showing the LINQ query structure and flow.
/// </summary>
public class QueryBreakdownGenerator
public static class QueryBreakdownGenerator
{
/// <summary>
/// Generates a Mermaid flowchart diagram from a LINQ to SQL QueryBreakdown.
@@ -8,7 +8,7 @@ namespace Strata.SqlTools.Markdown.LinqToSql;
/// Generates Mermaid diagrams for LINQ to SQL statements, including sequence diagrams
/// for statement execution flow and entity-relationship diagrams.
/// </summary>
public class SqlStatementGenerator
public static class SqlStatementGenerator
{
/// <summary>
/// Generates a Mermaid sequence diagram showing LINQ to SQL statement execution flow.
@@ -6,7 +6,7 @@ namespace Strata.SqlTools.Markdown.PostgreSql;
/// Generates Mermaid diagram markdown from PostgreSQL SQL QueryBreakdown objects.
/// Creates flowchart visualizations showing the query structure and flow.
/// </summary>
public class QueryBreakdownGenerator
public static class QueryBreakdownGenerator
{
/// <summary>
/// Generates a Mermaid flowchart diagram from a PostgreSQL QueryBreakdown.
@@ -6,7 +6,7 @@ namespace Strata.SqlTools.Markdown.PostgreSql;
/// Generates Mermaid diagrams for PostgreSQL SQL statements, including sequence diagrams
/// for statement execution flow and entity-relationship diagrams.
/// </summary>
public class SqlStatementGenerator
public static class SqlStatementGenerator
{
/// <summary>
/// Generates a Mermaid sequence diagram showing PostgreSQL SQL statement execution flow.
@@ -6,7 +6,7 @@ namespace Strata.SqlTools.Markdown.Snowflake;
/// Generates Mermaid diagram markdown from Snowflake SQL QueryBreakdown objects.
/// Creates flowchart visualizations showing the query structure and flow.
/// </summary>
public class QueryBreakdownGenerator
public static class QueryBreakdownGenerator
{
/// <summary>
/// Generates a Mermaid flowchart diagram from a Snowflake QueryBreakdown.
@@ -6,7 +6,7 @@ namespace Strata.SqlTools.Markdown.Snowflake;
/// Generates Mermaid diagrams for Snowflake SQL statements, including sequence diagrams
/// for statement execution flow and entity-relationship diagrams.
/// </summary>
public class SqlStatementGenerator
public static class SqlStatementGenerator
{
/// <summary>
/// Generates a Mermaid sequence diagram showing Snowflake SQL statement execution flow.
@@ -8,7 +8,7 @@ namespace Strata.SqlTools.Markdown.SqlServer;
/// Generates Mermaid diagram markdown from SQL QueryBreakdown objects.
/// Creates flowchart visualizations showing the query structure and flow.
/// </summary>
public class QueryBreakdownGenerator
public static class QueryBreakdownGenerator
{
/// <summary>
/// Generates a Mermaid flowchart diagram from a QueryBreakdown.
@@ -6,7 +6,7 @@ namespace Strata.SqlTools.Markdown.SqlServer;
/// <summary>
/// Generates Mermaid sequence diagrams from SQL statements to visualize statement execution flow.
/// </summary>
public class SqlStatementGenerator
public static class SqlStatementGenerator
{
/// <summary>
/// Generates a Mermaid sequence diagram showing SQL statement execution.
@@ -6,13 +6,11 @@ namespace Strata.SqlTools.Markdown.Tests.LinqToSql;
[TestFixture]
public class QueryBreakdownGeneratorTests
{
private QueryBreakdownGenerator _generator = null!;
private TestDataContext _context = null!;
[SetUp]
public void Setup()
{
_generator = new QueryBreakdownGenerator();
_context = new TestDataContext();
}
@@ -6,14 +6,6 @@ namespace Strata.SqlTools.Markdown.Tests.LinqToSql;
[TestFixture]
public class SqlStatementGeneratorTests
{
private SqlStatementGenerator _generator = null!;
[SetUp]
public void Setup()
{
_generator = new SqlStatementGenerator();
}
[Test]
public void GenerateLinqPipelineDiagram_BasicQuery_GeneratesSequenceDiagram()
{
@@ -6,14 +6,6 @@ namespace Strata.SqlTools.Markdown.Tests.PostgreSql;
[TestFixture]
public class QueryBreakdownGeneratorTests
{
private QueryBreakdownGenerator _generator = null!;
[SetUp]
public void Setup()
{
_generator = new QueryBreakdownGenerator();
}
[Test]
public void GenerateMermaidDiagram_SimplePostgreSqlQuery_GeneratesValidMermaid()
{
@@ -6,14 +6,6 @@ namespace Strata.SqlTools.Markdown.Tests.PostgreSql;
[TestFixture]
public class SqlStatementGeneratorTests
{
private SqlStatementGenerator _generator = null!;
[SetUp]
public void Setup()
{
_generator = new SqlStatementGenerator();
}
[Test]
public void GenerateSequenceDiagram_PostgreSqlQuery_GeneratesValidDiagram()
{
@@ -6,14 +6,6 @@ namespace Strata.SqlTools.Markdown.Tests.Snowflake;
[TestFixture]
public class QueryBreakdownGeneratorTests
{
private QueryBreakdownGenerator _generator = null!;
[SetUp]
public void Setup()
{
_generator = new QueryBreakdownGenerator();
}
[Test]
public void GenerateMermaidDiagram_SimpleSnowflakeQuery_GeneratesValidMermaid()
{
@@ -6,14 +6,6 @@ namespace Strata.SqlTools.Markdown.Tests.Snowflake;
[TestFixture]
public class SqlStatementGeneratorTests
{
private SqlStatementGenerator _generator = null!;
[SetUp]
public void Setup()
{
_generator = new SqlStatementGenerator();
}
[Test]
public void GenerateSequenceDiagram_SnowflakeQuery_GeneratesValidDiagram()
{
@@ -7,14 +7,6 @@ namespace Strata.SqlTools.Markdown.Tests.SqlServer;
[TestFixture]
public class QueryBreakdownGeneratorTests
{
private QueryBreakdownGenerator _generator = null!;
[SetUp]
public void Setup()
{
_generator = new QueryBreakdownGenerator();
}
[Test]
public void GenerateMermaidDiagram_WithSimpleQuery_GeneratesFlowchart()
{
@@ -8,15 +8,12 @@ namespace Strata.SqlTools.Markdown.Tests.SqlServer;
[Category("MarkdownGeneration")]
public class QueryMarkdownGenerationTests
{
private QueryBreakdownGenerator _generator = null!;
private string _queriesSourcePath = null!;
private string _markdownOutputPath = null!;
[SetUp]
public void Setup()
{
_generator = new QueryBreakdownGenerator();
// Get the solution root directory
var testDirectory = TestContext.CurrentContext.TestDirectory;
var solutionRoot = Directory.GetParent(testDirectory)?.Parent?.Parent?.Parent?.Parent?.FullName;
@@ -6,14 +6,6 @@ namespace Strata.SqlTools.Markdown.Tests.SqlServer;
[TestFixture]
public class SqlStatementGeneratorTests
{
private SqlStatementGenerator _generator = null!;
[SetUp]
public void Setup()
{
_generator = new SqlStatementGenerator();
}
[Test]
public void GenerateSequenceDiagram_WithSimpleQuery_GeneratesSequence()
{