Skip to content

Commit

Permalink
singular/plural
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Oct 5, 2024
1 parent c9656a0 commit 76462f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Plogon/BuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ private static void WriteNugetConfig(FileInfo output)
/// <returns>The result of the build</returns>
/// <exception cref="Exception">Generic build system errors</exception>
/// <exception cref="PluginCommitException">Error during repo commit, all no further work should be done</exception>
public async Task<BuildResult> ProcessTask(BuildTask task, bool commit, string? changelog, string? reviewer, ISet<BuildTask>? otherTasks)
public async Task<BuildResult> ProcessTask(BuildTask task, bool commit, string? changelog, string? reviewer, ISet<BuildTask> otherTasks)
{
if (commit && string.IsNullOrWhiteSpace(reviewer))
throw new Exception("Reviewer must be set when committing");
Expand Down
9 changes: 7 additions & 2 deletions Plogon/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ string ReplaceDiscordEmotes(string text)
var needsText = string.Empty;
if (allNeeds.Count > 0)
{
string Pluralize(int count, string singular)
{
return count == 1 ? singular : singular + "s";
}

var numUnreviewed = 0;
var numHidden = 0;
var needsTable = MarkdownTableBuilder.Create("Type", "Name", "Version", "Reviewed by");
Expand Down Expand Up @@ -559,10 +564,10 @@ string ReplaceDiscordEmotes(string text)

var hiddenText = string.Empty;
if (numHidden > 0)
hiddenText = $"\n\n##### {numHidden} hidden needs (known safe NuGet packages).\n";
hiddenText = $"\n\n##### {numHidden} hidden {Pluralize(numHidden, "need")} (known safe NuGet packages).\n";

needsText =
$"\n\n<details>\n<summary>{allNeeds.Count} Needs " +
$"\n\n<details>\n<summary>{allNeeds.Count} {Pluralize(allNeeds.Count, "Need")} " +
(numUnreviewed > 0 ? $"(⚠️ {numUnreviewed} UNREVIEWED)" : "(✅ All reviewed)") +
"</summary>\n\n" + needsTable.GetText() + hiddenText +
"</details>\n\n";
Expand Down

0 comments on commit 76462f1

Please sign in to comment.