refactor(dedup): remove redundant local TruncateText forwarders
SonarQube Analysis / sonarqube (pull_request) Successful in 3m58s

`QueryBreakdownGenerator`, `SqlStatementGenerator`, and
`ExpressionGenerator` each had a 1-line `private static string
TruncateText(...)` forwarder to `Internal.MarkdownTextHelpers.TruncateText`.
The forwarders existed only to keep existing call sites short
(`TruncateText(x, 50)` instead of the fully-qualified form).

Each file now imports `using static MarkdownTextHelpers;` once at the
top, so call sites continue to read identically and the local
forwarders are deleted. Removes the structural duplication Sonar was
flagging (two private static helpers — `EscapeMermaidText` + the
TruncateText forwarder — appearing in both `QueryBreakdownGenerator`
and `SqlStatementGenerator` with the same shape).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-27 17:11:39 -05:00
co-authored by Claude Opus 4.7
parent 4b6b3edc87
commit a84fe9768f
3 changed files with 3 additions and 7 deletions
@@ -10,6 +10,7 @@ using Strata.SqlTools.SqlBreakdown.Expressions.Functions.Aggregate;
using Strata.SqlTools.SqlBreakdown.Expressions.Functions.Conditional;
using Strata.SqlTools.SqlBreakdown.Expressions.Literals;
using Strata.SqlTools.SqlBreakdown.Interfaces.Core;
using static Strata.SqlTools.Markdown.Internal.MarkdownTextHelpers;
namespace Strata.SqlTools.Markdown.Expressions;
@@ -360,8 +361,6 @@ public class ExpressionGenerator : IVisitor<string>
.Replace("]", "&#93;");
}
private static string TruncateText(string text, int maxLength)
=> Internal.MarkdownTextHelpers.TruncateText(text, maxLength);
#region IVisitor Implementation
@@ -1,6 +1,7 @@
using System.Text;
using Strata.SqlTools.Breakdowns.SqlServer;
using Strata.SqlTools.SqlBreakdown.Interfaces;
using static Strata.SqlTools.Markdown.Internal.MarkdownTextHelpers;
namespace Strata.SqlTools.Markdown.SqlServer;
@@ -191,7 +192,5 @@ public static class QueryBreakdownGenerator
.Replace(">", "&gt;");
}
private static string TruncateText(string text, int maxLength)
=> Internal.MarkdownTextHelpers.TruncateText(text, maxLength);
}
@@ -1,5 +1,6 @@
using System.Text;
using Strata.SqlTools.SqlBreakdown.Interfaces;
using static Strata.SqlTools.Markdown.Internal.MarkdownTextHelpers;
namespace Strata.SqlTools.Markdown.SqlServer;
@@ -112,9 +113,6 @@ public static class SqlStatementGenerator
.Replace("\r", "");
}
private static string TruncateText(string text, int maxLength)
=> Internal.MarkdownTextHelpers.TruncateText(text, maxLength);
/// <summary>
/// Cleans table name for use in Mermaid diagrams.
/// </summary>