Public/Test-RdlcEmbeddedImageReference.ps1
function Test-RdlcEmbeddedImageReference { param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName, Position = 0)] [Alias('FullName')] [string[]]$Path ) process { $Path.ForEach{ $CurrentPath = $_ $EmbeddedImages = Get-RdlcEmbeddedImage -Path $CurrentPath | Select-Object -ExpandProperty Name $ReferencedEmbeddedImages = Get-RdlcEmbeddedImageReference -Path $CurrentPath | Select-Object -ExpandProperty Name $Result = $true $ReferencedEmbeddedImages | Where-Object { $_ -notin $EmbeddedImages } | ForEach-Object { Write-Error "$($CurrentPath) references an embedded image '$($_)' that does not exist."; $Result = $false } $EmbeddedImages | Where-Object { $_ -notin $ReferencedEmbeddedImages } | ForEach-Object { Write-Warning "Embedded image '$($_)' in $($CurrentPath) is not referenced and may be removed." } $Result } } } # FIXME: publish # FIXME: Test-reference error message appears to be broken # FIXME: Example: how to use as vs code action/in git commit hook |