Private/Get-TLScoreWeight.ps1
|
function Get-TLScoreWeight { <# .SYNOPSIS Returns the pass ratio (0..1) over all Pass/Fail findings. .DESCRIPTION v0.1: plain pass/fail ratio. Severity weighting lands with the score tile milestone (see roadmap v0.3). #> [CmdletBinding()] param( [Parameter(Mandatory)] [AllowEmptyCollection()] [object[]]$Findings ) $passCount = @($Findings | Where-Object { $_.Status -eq 'Pass' }).Count $failCount = @($Findings | Where-Object { $_.Status -eq 'Fail' }).Count $evaluated = $passCount + $failCount if ($evaluated -eq 0) { return 0.0 } return $passCount / [double]$evaluated } |