44 lines
1.2 KiB
PowerShell
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 {
|
|
}
|
|
}
|