OCram85/DroneHelper
OCram85
/
DroneHelper
Archived
1
0
Fork 0
This repository has been archived on 2023-10-10. You can view files and clone it, but cannot push or open issues or pull requests.
DroneHelper/src/Reports/Format-FileLinterReport.ps1

44 lines
1.2 KiB
PowerShell

function Format-FileLinterReport {
<#
.SYNOPSIS
Private helper function used by Write-ResultFile.
#>
[CmdletBinding()]
[OutputType([string])]
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[PSTypeName('DroneHelper.FileLinter.Report')]$InputObject
)
begin {
}
process {
$Output = @()
if ($InputObject.Success) {
$Output += ':heavy_check_mark: No FileLinter violations in {0} files found.' -f $InputObject.FilesCount
}
else {
$Output += "| Result | File | Failed |"
$Output += "| :----: | :--- | -----: |"
foreach ($file in $InputObject.Files) {
if ($file.FailedCount -gt 0) {
$failedTestNames = (
$file.Tests.GetEnumerator() | Where-Object {
$_.Value -eq $false
} | Select-Object -ExpandProperty 'Name'
) -join ', '
$Output += "| :heavy_exclamation_mark: | ``{0}`` | ``{1}`` |" -f $file.Name, $failedTestNames
}
}
}
Write-Output $Output
}
end {
}
}