Skip to content

Conversation

@littleKitchen
Copy link
Contributor

Summary

Resolves #371

Single-line fix to standardize error output in Invoke-YamlLint.ps1.

Change

Replace Write-Host with Write-Error in the catch block (line 179).

Before:

Write-Host "YAML Lint failed: $($_.Exception.Message)"

After:

Write-Error "YAML Lint failed: $($_.Exception.Message)"

Why

  • Write-Error writes to the error stream, which can be captured and redirected
  • Write-Host writes directly to console and cannot be captured in $Error
  • Maintains consistency with other linting scripts (Invoke-PSScriptAnalyzer.ps1, Invoke-LinkLanguageCheck.ps1, Markdown-Link-Check.ps1)

Testing

  • npm run lint:ps - PSScriptAnalyzer passes
  • npm run test:ps - All Pester tests pass

Resolves microsoft#371

Replace Write-Host with Write-Error in Invoke-YamlLint.ps1 catch block
to maintain consistency with other linting scripts.

Write-Error writes to the error stream which can be captured and redirected,
while Write-Host writes directly to console and cannot be captured in $Error.
@littleKitchen littleKitchen requested a review from a team as a code owner January 31, 2026 06:42
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 52.41%. Comparing base (15f7185) to head (da8a515).

Files with missing lines Patch % Lines
scripts/linting/Invoke-YamlLint.ps1 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #377      +/-   ##
==========================================
- Coverage   52.44%   52.41%   -0.04%     
==========================================
  Files          17       17              
  Lines        3110     3110              
==========================================
- Hits         1631     1630       -1     
- Misses       1479     1480       +1     
Flag Coverage Δ
pester 52.41% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/linting/Invoke-YamlLint.ps1 93.15% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@WilliamBerryiii WilliamBerryiii merged commit 2ca766b into microsoft:main Feb 1, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue]: Standardize error output in linting scripts (Write-Host vs Write-Error)

3 participants