Skip to content

Commit d2415ae

Browse files
Fix clang-tidy exit code handling in format.ps1
clang-tidy -fix uses exit code 1 to signal that fixes were applied, not a failure. The previous check treated any non-zero exit as a hard error, causing format.ps1 to abort whenever clang-tidy successfully auto-fixed source files. Only exit codes other than 0 or 1 now count as failures.
1 parent 2d0b189 commit d2415ae

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎format.ps1‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ try {
125125
$headerFilter = "(src|ext|lib|tests)/"
126126
$tidyArgs += @('-quiet', '-fix', '-fix-errors', '-fix-notes', $clangTidyFormatArg, "-header-filter=$headerFilter", $file)
127127
$tidyOutput = & $clangTidy.Path @tidyArgs 2>&1
128+
$tidyExitCode = $LASTEXITCODE
128129

129-
if ($LASTEXITCODE -ne 0) {
130+
if ($tidyExitCode -ne 0 -and $tidyExitCode -ne 1) {
130131
$lintFixFailures += [pscustomobject]@{
131132
File = $file
132133
Output = (($tidyOutput | ForEach-Object { $_.ToString() }) -join [Environment]::NewLine)

0 commit comments

Comments
 (0)