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-ScriptAnalyzerReport...

41 lines
1.2 KiB
PowerShell

function Format-ScriptAnalyzerReport {
<#
.SYNOPSIS
Private helper function used by Write-ResultFile.
#>
[CmdletBinding()]
[OutputType([string])]
param (
[Parameter(Mandatory = $true)]
[PSCustomObject]$InputObject
)
begin {
}
process {
$Output = @()
$Output += "| Severity | ScriptName | Line | RuleName | Message |"
$Output += "| :------: | :--------- | :--: | :------- | :------ |"
foreach ( $v in $InputObject ) {
switch ($v.Severity) {
'Warning' { $Emoji = ':warning:' }
'Error' { $Emoji = ':heavy_exclamation_mark:' }
'Information' { $Emoji = ':mag:' }
Default { $Emoji = ':fried_egg:' }
}
$RawString = "| {0} | {1} | {2} | {3} | {4} |"
$Output += $RawString -f $Emoji, $v.ScriptName, $v.Line, $v.RuleName, $v.Message
}
$RuleURL = 'https://github.com/PowerShell/PSScriptAnalyzer/tree/master/RuleDocumentation'
$Output += "`n> See [RuleDocumentation]({0}) for additional help.`n" -f $RuleURL
Write-Output $Output
}
end {
}
}