Skip to content

Commit ab2577f

Browse files
CopilotMalcolmnixon
andcommitted
Complete code cleanup - Fix all CodeQL and SonarCloud issues
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
1 parent cedd83c commit ab2577f

File tree

5 files changed

+687
-313
lines changed

5 files changed

+687
-313
lines changed

src/DemaConsulting.BuildMark/BuildInformation.cs

Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,38 @@ public string ToMarkdown(int headingDepth = 1, bool includeKnownIssues = false)
5959
markdown.AppendLine();
6060

6161
// Add version information section
62+
AppendVersionInformation(markdown, subHeading);
63+
64+
// Add changes section
65+
AppendChangesSection(markdown, subHeading);
66+
67+
// Add bugs fixed section
68+
AppendBugsFixedSection(markdown, subHeading);
69+
70+
// Add known issues section if requested
71+
if (includeKnownIssues)
72+
{
73+
AppendKnownIssuesSection(markdown, subHeading);
74+
}
75+
76+
// Return the complete markdown report
77+
return markdown.ToString();
78+
}
79+
80+
/// <summary>
81+
/// Appends the version information section to the markdown report.
82+
/// </summary>
83+
/// <param name="markdown">StringBuilder containing the markdown report.</param>
84+
/// <param name="subHeading">Sub-heading prefix.</param>
85+
private void AppendVersionInformation(System.Text.StringBuilder markdown, string subHeading)
86+
{
6287
markdown.AppendLine($"{subHeading} Version Information");
6388
markdown.AppendLine();
6489
markdown.AppendLine("| Field | Value |");
6590
markdown.AppendLine("|-------|-------|");
6691
markdown.AppendLine($"| **Version** | {ToVersion.Tag} |");
6792
markdown.AppendLine($"| **Commit Hash** | {ToHash} |");
93+
6894
if (FromVersion != null)
6995
{
7096
markdown.AppendLine($"| **Previous Version** | {FromVersion.Tag} |");
@@ -75,13 +101,22 @@ public string ToMarkdown(int headingDepth = 1, bool includeKnownIssues = false)
75101
markdown.AppendLine("| **Previous Version** | N/A |");
76102
markdown.AppendLine("| **Previous Commit Hash** | N/A |");
77103
}
104+
78105
markdown.AppendLine();
106+
}
79107

80-
// Add changes section
108+
/// <summary>
109+
/// Appends the changes section to the markdown report.
110+
/// </summary>
111+
/// <param name="markdown">StringBuilder containing the markdown report.</param>
112+
/// <param name="subHeading">Sub-heading prefix.</param>
113+
private void AppendChangesSection(System.Text.StringBuilder markdown, string subHeading)
114+
{
81115
markdown.AppendLine($"{subHeading} Changes");
82116
markdown.AppendLine();
83117
markdown.AppendLine("| Issue | Title |");
84118
markdown.AppendLine("|-------|-------|");
119+
85120
if (Changes.Count > 0)
86121
{
87122
foreach (var issue in Changes)
@@ -93,13 +128,22 @@ public string ToMarkdown(int headingDepth = 1, bool includeKnownIssues = false)
93128
{
94129
markdown.AppendLine("| N/A | N/A |");
95130
}
131+
96132
markdown.AppendLine();
133+
}
97134

98-
// Add bugs fixed section
135+
/// <summary>
136+
/// Appends the bugs fixed section to the markdown report.
137+
/// </summary>
138+
/// <param name="markdown">StringBuilder containing the markdown report.</param>
139+
/// <param name="subHeading">Sub-heading prefix.</param>
140+
private void AppendBugsFixedSection(System.Text.StringBuilder markdown, string subHeading)
141+
{
99142
markdown.AppendLine($"{subHeading} Bugs Fixed");
100143
markdown.AppendLine();
101144
markdown.AppendLine("| Issue | Title |");
102145
markdown.AppendLine("|-------|-------|");
146+
103147
if (Bugs.Count > 0)
104148
{
105149
foreach (var issue in Bugs)
@@ -111,30 +155,34 @@ public string ToMarkdown(int headingDepth = 1, bool includeKnownIssues = false)
111155
{
112156
markdown.AppendLine("| N/A | N/A |");
113157
}
158+
114159
markdown.AppendLine();
160+
}
115161

116-
// Add known issues section if requested
117-
if (includeKnownIssues)
162+
/// <summary>
163+
/// Appends the known issues section to the markdown report.
164+
/// </summary>
165+
/// <param name="markdown">StringBuilder containing the markdown report.</param>
166+
/// <param name="subHeading">Sub-heading prefix.</param>
167+
private void AppendKnownIssuesSection(System.Text.StringBuilder markdown, string subHeading)
168+
{
169+
markdown.AppendLine($"{subHeading} Known Issues");
170+
markdown.AppendLine();
171+
markdown.AppendLine("| Issue | Title |");
172+
markdown.AppendLine("|-------|-------|");
173+
174+
if (KnownIssues.Count > 0)
118175
{
119-
markdown.AppendLine($"{subHeading} Known Issues");
120-
markdown.AppendLine();
121-
markdown.AppendLine("| Issue | Title |");
122-
markdown.AppendLine("|-------|-------|");
123-
if (KnownIssues.Count > 0)
176+
foreach (var issue in KnownIssues)
124177
{
125-
foreach (var issue in KnownIssues)
126-
{
127-
markdown.AppendLine($"| [{issue.Id}]({issue.Url}) | {issue.Title} |");
128-
}
129-
}
130-
else
131-
{
132-
markdown.AppendLine("| N/A | N/A |");
178+
markdown.AppendLine($"| [{issue.Id}]({issue.Url}) | {issue.Title} |");
133179
}
134-
markdown.AppendLine();
180+
}
181+
else
182+
{
183+
markdown.AppendLine("| N/A | N/A |");
135184
}
136185

137-
// Return the complete markdown report
138-
return markdown.ToString();
186+
markdown.AppendLine();
139187
}
140188
}

0 commit comments

Comments
 (0)