function Write-ResultFile { <# .SYNOPSIS Writes the current pipeline step into failure log. .DESCRIPTION This Cmdlet is used to mark single steps as failed without stopping the complete pipeline. .PARAMETER StepName The current DroneHelper step name which should be added into to the log. .INPUTS [None] No pipeline input. .OUTPUTS [None] No pipeline output. .EXAMPLE Write-FailureStateFile #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [PSCustomObject]$InputObject, [Parameter(Mandatory = $true)] [String]$Path, [Parameter(Mandatory = $true)] [ValidateSet('Pester', 'PSScriptAnalyzer', 'FileLinter', 'Custom')] [String]$Type ) process { [String[]]$Output = @() if ($BlockDescription -ne "") { $BlockDescription | Out-File -FilePath $Path -Encoding utf8 -Force -NoClobber -Append } switch ($Type) { 'Pester' { $Output = Format-PesterReport -InputObject $InputObject } 'PSScriptAnalyzer' { $Output = Format-ScriptAnalyzerReport -InputObject $InputObject } 'FileLinter' { $Output = Format-FileLinterReport -InputObject $InputObject } 'Custom' { # nothing to do here $Output = $InputObject + [Environment]::NewLine } } $Output | Out-File -FilePath $Path -Encoding utf8 -Force -NoClobber -Append } }