Skip to content

Commit 9566a2c

Browse files
authored
Merge pull request #2543 from microsoft/dpaul-fix-codeformatter-strictmode
Fix CodeFormatter strict mode error when processing a single file
2 parents d562c64 + 67eacc9 commit 9566a2c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.build/Invoke-CodeFormatterOnFiles.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ function Invoke-CodeFormatterOnFiles {
3535

3636
$repoRoot = Get-Item "$PSScriptRoot\.."
3737
$errorCount = 0
38+
$filesToCheck = New-Object System.Collections.Generic.List[object]
3839

39-
$filesToCheck = foreach ($path in $FilePaths) {
40+
foreach ($path in $FilePaths) {
4041
if (Test-Path -Path $path) {
41-
Get-Item -Path $path
42+
$filesToCheck.Add((Get-Item -Path $path))
4243
} else {
4344
Write-Warning "File not found, skipping: $path"
4445
}
4546
}
4647

47-
if ($null -eq $filesToCheck -or $filesToCheck.Count -eq 0) {
48+
if ($filesToCheck.Count -eq 0) {
4849
Write-Host "No valid files to check."
4950
return 0
5051
}

0 commit comments

Comments
 (0)