Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions eng/common/scripts/check-spelling-in-changed-files.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ $spellingErrors = &"$PSScriptRoot/../spelling/Invoke-Cspell.ps1" `
-CspellConfigPath $CspellConfigPath `
-SpellCheckRoot $SpellCheckRoot `
-FileList $changedFilePaths
$cspellExitCode = $LASTEXITCODE

if ($spellingErrors) {
$errorLoggingFunction = Get-Item 'Function:LogWarning'
Expand All @@ -130,6 +131,9 @@ if ($spellingErrors) {
if ($ExitWithError) {
exit 1
}
} elseif ($cspellExitCode -ne 0 -and $ExitWithError) {
LogError "CSpell exited with code $cspellExitCode. This may indicate a configuration error or other failure in the spell checking tool."
exit 1
Comment on lines +134 to +136
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new $cspellExitCode handling still reports success when Invoke-Cspell.ps1 fails but -ExitWithError isn’t set: the script will fall into the final else and print "No spelling errors detected" while returning 0. Consider treating non-zero cspell exit codes as failures (or at least logging a warning and exiting with the same non-zero code) regardless of -ExitWithError, so CI tasks configured with continueOnError: true still surface tool/config failures as a warning rather than a silent pass.

Suggested change
} elseif ($cspellExitCode -ne 0 -and $ExitWithError) {
LogError "CSpell exited with code $cspellExitCode. This may indicate a configuration error or other failure in the spell checking tool."
exit 1
} elseif ($cspellExitCode -ne 0) {
if ($ExitWithError) {
LogError "CSpell exited with code $cspellExitCode. This may indicate a configuration error or other failure in the spell checking tool."
} else {
LogWarning "CSpell exited with code $cspellExitCode. This may indicate a configuration error or other failure in the spell checking tool."
}
exit $cspellExitCode

Copilot uses AI. Check for mistakes.
} else {
Write-Host "No spelling errors detected"
}
Expand Down
Loading