Updater 3.4 – Lifecycle Hardening #28

Merged
Masterluke77 merged 96 commits from feature/updater-3.4-lifecycle into main 2026-07-10 17:54:37 +00:00
Showing only changes of commit d1f16a4c5c - Show all commits
+20 -5
View File
@@ -1,5 +1,7 @@
[CmdletBinding()]
param()
param(
[string]$ReportPath = ''
)
Set-StrictMode -Version 2.0
$ErrorActionPreference = 'Stop'
@@ -10,7 +12,7 @@ $files = Get-ChildItem -LiteralPath $root -Recurse -File | Where-Object {
} | Where-Object {
$full = $_.FullName
-not (@($excludedParts | Where-Object { $full.IndexOf($_,[StringComparison]::OrdinalIgnoreCase) -ge 0 }).Count)
}
} | Sort-Object FullName
$failures = New-Object System.Collections.Generic.List[string]
foreach ($file in $files) {
@@ -18,14 +20,27 @@ foreach ($file in $files) {
$errors = $null
[void][System.Management.Automation.Language.Parser]::ParseFile($file.FullName,[ref]$tokens,[ref]$errors)
foreach ($parseError in @($errors)) {
$failures.Add(("{0}:{1}:{2} {3}" -f $parseError.Extent.File,$parseError.Extent.StartLineNumber,$parseError.Extent.StartColumnNumber,$parseError.Message))
$relative = $file.FullName.Substring($root.Length).TrimStart('\')
$failures.Add(("{0}:{1}:{2} {3}" -f $relative,$parseError.Extent.StartLineNumber,$parseError.Extent.StartColumnNumber,$parseError.Message))
}
}
if ($failures.Count -gt 0) {
Write-Error ("Windows-PowerShell-Parser-Gate fehlgeschlagen ({0} Fehler):{1}{2}" -f $failures.Count,[Environment]::NewLine,(@($failures) -join [Environment]::NewLine))
$report = "Windows-PowerShell-Parser-Gate fehlgeschlagen ($($failures.Count) Fehler):$([Environment]::NewLine)$(@($failures) -join [Environment]::NewLine)"
} else {
$report = "OK: Windows PowerShell $($PSVersionTable.PSVersion) hat $($files.Count) PowerShell-Dateien ohne Parserfehler akzeptiert."
}
if (-not [string]::IsNullOrWhiteSpace($ReportPath)) {
$parent = Split-Path -Parent $ReportPath
if ($parent) { New-Item -ItemType Directory -Path $parent -Force | Out-Null }
[IO.File]::WriteAllText($ReportPath,$report,(New-Object Text.UTF8Encoding($false)))
}
if ($failures.Count -gt 0) {
[Console]::Error.WriteLine($report)
exit 1
}
Write-Host ("OK: Windows PowerShell {0} hat {1} PowerShell-Dateien ohne Parserfehler akzeptiert." -f $PSVersionTable.PSVersion,$files.Count)
Write-Host $report
exit 0