Reject native verification parse errors before launch and fix split dispatch branch

This commit is contained in:
NINI
2026-10-07 00:20:48 +09:00
parent d3b2ede09d
commit 913f19c360
3 changed files with 14 additions and 1 deletions
+12
View File
@@ -0,0 +1,12 @@
param([Parameter(Mandatory)][string]$EvidenceDir,[string[]]$Sources)
$ErrorActionPreference='Stop'
New-Item -ItemType Directory -Path $EvidenceDir -Force|Out-Null
if(!$Sources){$Sources=@(Get-ChildItem $PSScriptRoot -Filter '*.ps1'|Select-Object -ExpandProperty FullName)}
$results=@(foreach($source in $Sources){
$errors=$null
[Management.Automation.Language.Parser]::ParseFile($source,[ref]$null,[ref]$errors)|Out-Null
@{source=$source;passed=($errors.Count-eq0);errors=@($errors|Select-Object ErrorId,Message,@{n='line';e={$_.Extent.StartLineNumber}})}
})
$passed=$results.Count-gt0-and@($results|Where-Object passed -ne $true).Count-eq0
@{passed=$passed;checks=$results}|ConvertTo-Json -Depth 8|Set-Content (Join-Path $EvidenceDir 'syntax-result.json')
if(!$passed){exit 1};exit 0