From 855d1df32fef5c8855e61050d53c6840d0dd0436 Mon Sep 17 00:00:00 2001 From: fukusuket <41001169+fukusuket@users.noreply.github.com> Date: Fri, 21 Mar 2025 01:04:35 +0900 Subject: [PATCH] chg: Output horizontally --- WELA.ps1 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/WELA.ps1 b/WELA.ps1 index 7a5d0019..376431cb 100644 --- a/WELA.ps1 +++ b/WELA.ps1 @@ -58,12 +58,24 @@ function Set-Applicable { function Get-RuleCounts { param ($rules) - $rules | Group-Object -Property level | ForEach-Object { + $levels = @("critical", "high", "medium", "low", "informational") + $counts = $rules | Group-Object -Property level | ForEach-Object { [PSCustomObject]@{ Level = $_.Name Count = $_.Count } } + + foreach ($level in $levels) { + if (-not ($counts | Where-Object { $_.Level -eq $level })) { + $counts += [PSCustomObject]@{ + Level = $level + Count = 0 + } + } + } + + return $counts } function CalculateUsableRate {