Skip to content

Commit d40d1d2

Browse files
Implement literate coding style with comprehensive XmlDoc coverage (#34)
* Initial plan * Add literate coding style comments to remaining source and test files Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> * Remove duplicate comments as identified by code review Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> * Remove additional redundant comments per code review feedback * Fix XmlDoc formatting issues - Fixed XmlDoc indentation in GitHubGraphQLClient.cs to use consistent 4-space indentation for content - Added missing XmlDoc comment for _openIssues field in MockRepoConnector.cs All XmlDoc comments now follow the project's standard formatting: - Opening/closing tags on their own lines without extra indentation - Content between tags indented with 4 spaces after /// * Add XmlDoc comments to private fields in MockRepoConnector and GitHubRepoConnector - Add XmlDoc to _issueTitles field in MockRepoConnector - Add XmlDoc to _issueTypes field in MockRepoConnector - Add XmlDoc to _pullRequestIssues field in MockRepoConnector - Add XmlDoc to _tagHashes field in MockRepoConnector - Add XmlDoc to LabelTypeMap field in GitHubRepoConnector All XmlDoc comments use proper 4-space indentation after ///. This completes comprehensive XmlDoc coverage for all C# source files. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
1 parent 263c6c0 commit d40d1d2

File tree

8 files changed

+132
-23
lines changed

8 files changed

+132
-23
lines changed

src/DemaConsulting.BuildMark/BuildInformation.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ public string ToMarkdown(int headingDepth = 1, bool includeKnownIssues = false)
8484
/// <param name="subHeading">Sub-heading prefix.</param>
8585
private void AppendVersionInformation(System.Text.StringBuilder markdown, string subHeading)
8686
{
87+
// Add version information section header and table structure
8788
markdown.AppendLine($"{subHeading} Version Information");
8889
markdown.AppendLine();
8990
markdown.AppendLine("| Field | Value |");
9091
markdown.AppendLine("|-------|-------|");
9192
markdown.AppendLine($"| **Version** | {ToVersion.Tag} |");
9293
markdown.AppendLine($"| **Commit Hash** | {ToHash} |");
9394

95+
// Add previous version information or N/A if this is the first release
9496
if (FromVersion != null)
9597
{
9698
markdown.AppendLine($"| **Previous Version** | {FromVersion.Tag} |");
@@ -102,6 +104,7 @@ private void AppendVersionInformation(System.Text.StringBuilder markdown, string
102104
markdown.AppendLine("| **Previous Commit Hash** | N/A |");
103105
}
104106

107+
// Add blank line after section
105108
markdown.AppendLine();
106109
}
107110

@@ -112,11 +115,13 @@ private void AppendVersionInformation(System.Text.StringBuilder markdown, string
112115
/// <param name="subHeading">Sub-heading prefix.</param>
113116
private void AppendChangesSection(System.Text.StringBuilder markdown, string subHeading)
114117
{
118+
// Add changes section header and table structure
115119
markdown.AppendLine($"{subHeading} Changes");
116120
markdown.AppendLine();
117121
markdown.AppendLine("| Issue | Title |");
118122
markdown.AppendLine("|-------|-------|");
119123

124+
// Add change items or N/A if no changes exist
120125
if (Changes.Count > 0)
121126
{
122127
foreach (var issue in Changes)
@@ -129,6 +134,7 @@ private void AppendChangesSection(System.Text.StringBuilder markdown, string sub
129134
markdown.AppendLine("| N/A | N/A |");
130135
}
131136

137+
// Add blank line after section
132138
markdown.AppendLine();
133139
}
134140

@@ -139,11 +145,13 @@ private void AppendChangesSection(System.Text.StringBuilder markdown, string sub
139145
/// <param name="subHeading">Sub-heading prefix.</param>
140146
private void AppendBugsFixedSection(System.Text.StringBuilder markdown, string subHeading)
141147
{
148+
// Add bugs fixed section header and table structure
142149
markdown.AppendLine($"{subHeading} Bugs Fixed");
143150
markdown.AppendLine();
144151
markdown.AppendLine("| Issue | Title |");
145152
markdown.AppendLine("|-------|-------|");
146153

154+
// Add bug items or N/A if no bugs were fixed
147155
if (Bugs.Count > 0)
148156
{
149157
foreach (var issue in Bugs)
@@ -156,6 +164,7 @@ private void AppendBugsFixedSection(System.Text.StringBuilder markdown, string s
156164
markdown.AppendLine("| N/A | N/A |");
157165
}
158166

167+
// Add blank line after section
159168
markdown.AppendLine();
160169
}
161170

@@ -166,11 +175,13 @@ private void AppendBugsFixedSection(System.Text.StringBuilder markdown, string s
166175
/// <param name="subHeading">Sub-heading prefix.</param>
167176
private void AppendKnownIssuesSection(System.Text.StringBuilder markdown, string subHeading)
168177
{
178+
// Add known issues section header and table structure
169179
markdown.AppendLine($"{subHeading} Known Issues");
170180
markdown.AppendLine();
171181
markdown.AppendLine("| Issue | Title |");
172182
markdown.AppendLine("|-------|-------|");
173183

184+
// Add known issue items or N/A if no known issues exist
174185
if (KnownIssues.Count > 0)
175186
{
176187
foreach (var issue in KnownIssues)
@@ -183,6 +194,7 @@ private void AppendKnownIssuesSection(System.Text.StringBuilder markdown, string
183194
markdown.AppendLine("| N/A | N/A |");
184195
}
185196

197+
// Add blank line after section
186198
markdown.AppendLine();
187199
}
188200
}

src/DemaConsulting.BuildMark/RepoConnectors/GitHubGraphQLClient.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,33 @@
2525
namespace DemaConsulting.BuildMark.RepoConnectors;
2626

2727
/// <summary>
28-
/// Helper class for executing GitHub GraphQL queries.
28+
/// Helper class for executing GitHub GraphQL queries.
2929
/// </summary>
3030
internal sealed class GitHubGraphQLClient : IDisposable
3131
{
3232
/// <summary>
33-
/// Default GitHub GraphQL API endpoint.
33+
/// Default GitHub GraphQL API endpoint.
3434
/// </summary>
3535
private const string DefaultGitHubGraphQLEndpoint = "https://api.github.com/graphql";
3636

3737
/// <summary>
38-
/// HTTP client for making GraphQL requests.
38+
/// HTTP client for making GraphQL requests.
3939
/// </summary>
4040
private readonly HttpClient _httpClient;
4141

4242
/// <summary>
43-
/// GraphQL endpoint URL.
43+
/// GraphQL endpoint URL.
4444
/// </summary>
4545
private readonly string _graphqlEndpoint;
4646

4747
/// <summary>
48-
/// Initializes a new instance of the <see cref="GitHubGraphQLClient"/> class.
48+
/// Initializes a new instance of the <see cref="GitHubGraphQLClient"/> class.
4949
/// </summary>
5050
/// <param name="token">GitHub authentication token.</param>
5151
/// <param name="graphqlEndpoint">Optional GraphQL endpoint URL. Defaults to public GitHub API. For GitHub Enterprise, use https://your-github-enterprise/api/graphql.</param>
5252
public GitHubGraphQLClient(string token, string? graphqlEndpoint = null)
5353
{
54+
// Initialize HTTP client with authentication and user agent headers
5455
_httpClient = new HttpClient();
5556
_httpClient.DefaultRequestHeaders.Authorization =
5657
new AuthenticationHeaderValue("Bearer", token);
@@ -60,7 +61,7 @@ public GitHubGraphQLClient(string token, string? graphqlEndpoint = null)
6061
}
6162

6263
/// <summary>
63-
/// Finds issue IDs linked to a pull request via closingIssuesReferences.
64+
/// Finds issue IDs linked to a pull request via closingIssuesReferences.
6465
/// </summary>
6566
/// <param name="owner">Repository owner.</param>
6667
/// <param name="repo">Repository name.</param>
@@ -96,12 +97,15 @@ public async Task<List<int>> FindIssueIdsLinkedToPullRequestAsync(
9697
}
9798
};
9899

100+
// Serialize query and send POST request to GraphQL endpoint
99101
var jsonContent = JsonSerializer.Serialize(graphqlQuery);
100102
using var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
101103

104+
// Execute GraphQL query and ensure success
102105
var response = await _httpClient.PostAsync(_graphqlEndpoint, content);
103106
response.EnsureSuccessStatusCode();
104107

108+
// Parse response JSON
105109
var responseBody = await response.Content.ReadAsStringAsync();
106110
var jsonDoc = JsonDocument.Parse(responseBody);
107111

@@ -113,13 +117,15 @@ public async Task<List<int>> FindIssueIdsLinkedToPullRequestAsync(
113117
pullRequest.TryGetProperty("closingIssuesReferences", out var closingIssues) &&
114118
closingIssues.TryGetProperty("nodes", out var nodes))
115119
{
120+
// Enumerate all issue nodes and extract their numbers
116121
foreach (var node in nodes.EnumerateArray().Where(n => n.TryGetProperty("number", out _)))
117122
{
118123
node.TryGetProperty("number", out var number);
119124
issueNumbers.Add(number.GetInt32());
120125
}
121126
}
122127

128+
// Return list of linked issue numbers
123129
return issueNumbers;
124130
}
125131
catch
@@ -130,10 +136,11 @@ public async Task<List<int>> FindIssueIdsLinkedToPullRequestAsync(
130136
}
131137

132138
/// <summary>
133-
/// Disposes the HTTP client.
139+
/// Disposes the HTTP client.
134140
/// </summary>
135141
public void Dispose()
136142
{
143+
// Clean up HTTP client resources
137144
_httpClient.Dispose();
138145
}
139146
}

0 commit comments

Comments
 (0)