-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Labels
good first issueGood for newcomersGood for newcomersneeds-triageRequires triage and prioritizationRequires triage and prioritization
Description
Issue Description
The linting scripts in scripts/linting/ use inconsistent error output methods. Most scripts use Write-Error for error reporting in catch blocks, but Invoke-YamlLint.ps1 uses Write-Host instead.
Current state in Invoke-YamlLint.ps1 (line 179):
catch {
Write-Host "YAML Lint failed: $($_.Exception.Message)"
if ($env:GITHUB_ACTIONS -eq 'true') {
$escapedMsg = ConvertTo-GitHubActionsEscaped -Value $_.Exception.Message
Write-Output "::error::$escapedMsg"
}
exit 1
}Expected pattern (used by other scripts):
catch {
Write-Error "YAML Lint failed: $($_.Exception.Message)"
if ($env:GITHUB_ACTIONS -eq 'true') {
$escapedMsg = ConvertTo-GitHubActionsEscaped -Value $_.Exception.Message
Write-Output "::error::$escapedMsg"
}
exit 1
}Recommendation
-
File to modify:
scripts/linting/Invoke-YamlLint.ps1 -
Change required: Replace
Write-HostwithWrite-Errorat line 179 -
Why this matters:
Write-Errorwrites to the error stream, which can be captured and redirectedWrite-Hostwrites directly to the console and cannot be captured in$Erroror redirected- Consistency across scripts makes the codebase easier to maintain
-
Validation steps:
npm run lint:ps # Should pass PSScriptAnalyzer npm run test:ps # Should pass all Pester tests
-
Reference files showing the correct pattern:
scripts/linting/Invoke-PSScriptAnalyzer.ps1(line ~153)scripts/linting/Invoke-LinkLanguageCheck.ps1(line ~127)scripts/linting/Markdown-Link-Check.ps1(line ~384)
Additional Context
This inconsistency was discovered during code review of PR #367. The fix is a single-line change and serves as a good introduction to the PowerShell linting infrastructure.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersneeds-triageRequires triage and prioritizationRequires triage and prioritization