Skip to content

Commit 33dd122

Browse files
committed
chore: Smaller cleanup
1 parent cfee2e0 commit 33dd122

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

src/NetEvolve.CodeBuilder/CSharpCodeBuilder.Documentation.cs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@ public CSharpCodeBuilder AppendXmlDocSummary(IEnumerable<string>? summaryLines)
5151
var hasContent = false;
5252
var builder = EnsureNewLineForXmlDoc().AppendLine("/// <summary>");
5353

54-
foreach (var line in summaryLines)
54+
foreach (var line in summaryLines.Where(l => !string.IsNullOrEmpty(l)))
5555
{
56-
if (!string.IsNullOrEmpty(line))
57-
{
58-
builder = builder.AppendLine($"/// {line}");
59-
hasContent = true;
60-
}
56+
builder = builder.AppendLine($"/// {line}");
57+
hasContent = true;
6158
}
6259

6360
return hasContent ? builder.AppendLine("/// </summary>") : this;
@@ -153,13 +150,10 @@ public CSharpCodeBuilder AppendXmlDocRemarks(IEnumerable<string>? remarksLines)
153150
var hasContent = false;
154151
var builder = EnsureNewLineForXmlDoc().AppendLine("/// <remarks>");
155152

156-
foreach (var line in remarksLines)
153+
foreach (var line in remarksLines.Where(l => !string.IsNullOrEmpty(l)))
157154
{
158-
if (!string.IsNullOrEmpty(line))
159-
{
160-
builder = builder.AppendLine($"/// {line}");
161-
hasContent = true;
162-
}
155+
builder = builder.AppendLine($"/// {line}");
156+
hasContent = true;
163157
}
164158

165159
return hasContent ? builder.AppendLine("/// </remarks>") : this;
@@ -240,13 +234,10 @@ public CSharpCodeBuilder AppendXmlDocExample(IEnumerable<string>? exampleLines)
240234
var hasContent = false;
241235
var builder = EnsureNewLineForXmlDoc().AppendLine("/// <example>");
242236

243-
foreach (var line in exampleLines)
237+
foreach (var line in exampleLines.Where(l => !string.IsNullOrEmpty(l)))
244238
{
245-
if (!string.IsNullOrEmpty(line))
246-
{
247-
builder = builder.AppendLine($"/// {line}");
248-
hasContent = true;
249-
}
239+
builder = builder.AppendLine($"/// {line}");
240+
hasContent = true;
250241
}
251242

252243
return hasContent ? builder.AppendLine("/// </example>") : this;

src/NetEvolve.CodeBuilder/CodeBuilderBase.EnsureIndented.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ private protected void EnsureIndented(bool deactivate = false)
1919
return;
2020
}
2121

22-
_ = _builder.Append(UseTabs ? '\t' : ' ', _indentLevel * (UseTabs ? 1 : 4));
22+
if (UseTabs)
23+
{
24+
_ = _builder.Append('\t', _indentLevel);
25+
}
26+
else
27+
{
28+
_ = _builder.Append(' ', _indentLevel * 4);
29+
}
2330

2431
_isNewline = false;
2532
}

0 commit comments

Comments
 (0)