From ba66567963444b4060abd450565e356d27ceca84 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Tue, 5 Dec 2023 08:41:08 +0100 Subject: [PATCH] fix(commands): Avoid a duplicate plural "s" in the summary sentence This fixes the "ss" in a sentence like "There are 138 unresolved rule violationss with a severity ...". Signed-off-by: Sebastian Schuberth --- .../api/src/main/kotlin/utils/SeverityStatsPrinter.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/commands/api/src/main/kotlin/utils/SeverityStatsPrinter.kt b/plugins/commands/api/src/main/kotlin/utils/SeverityStatsPrinter.kt index 28718f7ae4f95..05f1198bd5793 100644 --- a/plugins/commands/api/src/main/kotlin/utils/SeverityStatsPrinter.kt +++ b/plugins/commands/api/src/main/kotlin/utils/SeverityStatsPrinter.kt @@ -50,7 +50,7 @@ class SeverityStatsPrinter(private val terminal: Terminal, private val resolutio Theme.Default.success(text) } - terminal.println("${Theme.Default.info("Resolved $name:")} ${resolved.joinToString()}.") + terminal.println("${Theme.Default.info("Resolved ${name}s:")} ${resolved.joinToString()}.") val unresolved = Severity.entries.toTypedArray().sortedArrayDescending().map { val count = unresolvedCounts.getOrDefault(it, 0) @@ -58,7 +58,7 @@ class SeverityStatsPrinter(private val terminal: Terminal, private val resolutio if (count == 0) Theme.Default.success(text) else Theme.Default.danger(text) } - terminal.println("${Theme.Default.warning("Unresolved $name:")} ${unresolved.joinToString()}.") + terminal.println("${Theme.Default.warning("Unresolved ${name}s:")} ${unresolved.joinToString()}.") } /** @@ -86,11 +86,11 @@ class SeverityStatsPrinter(private val terminal: Terminal, private val resolutio @JvmName("statsForIssues") fun stats(issues: Collection) = - stats("issues", issues.partition { resolutionProvider.isResolved(it) }) { severity } + stats("issue", issues.partition { resolutionProvider.isResolved(it) }) { severity } @JvmName("statsForRuleViolations") fun stats(ruleViolations: Collection) = - stats("rule violations", ruleViolations.partition { resolutionProvider.isResolved(it) }) { severity } + stats("rule violation", ruleViolations.partition { resolutionProvider.isResolved(it) }) { severity } private fun stats(name: String, thingsWithSeverities: Pair, List>, selector: T.() -> Severity) = Entry(