SparKURS.DAW/Test-ScriptSyntax.ps1
Edmond Gebara a5e28a7f52 changed: logging
changed: sort and deduplicate output
changed: "GruppenVerwaltungNEU..." output
2026-07-06 06:50:50 +02:00

20 lines
No EOL
579 B
PowerShell

# Test-ScriptSyntax.ps1 - parses all .ps1 files without executing them
param([string] $Path = ".")
Get-ChildItem -Path $Path -Filter *.ps1 | ForEach-Object {
$tokens = $null
$errors = $null
[System.Management.Automation.Language.Parser]::ParseFile(
$_.FullName, [ref]$tokens, [ref]$errors) | Out-Null
if ($errors.Count -gt 0)
{
Write-Output "FAIL: $($_.Name) ($($errors.Count) Fehler)"
$errors | ForEach-Object {
Write-Output (" Zeile {0}: {1}" -f $_.Extent.StartLineNumber, $_.Message)
}
}
else
{
Write-Output "OK: $($_.Name)"
}
}