Skip to content

Commit e7cc802

Browse files
committed
Remove IgnoreCase parameter and enhance whitespace mismatch reporting in JSON name alignment check
1 parent 0dd7b05 commit e7cc802

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

scripts/checks/check-name-alignment.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
param(
22
[switch]$Changed,
3-
[switch]$IgnoreCase,
43
[switch]$IncludeNonMaps
54
)
65

@@ -108,18 +107,19 @@ foreach ($file in $files) {
108107
$expected = [System.IO.Path]::GetFileNameWithoutExtension($file)
109108
$actual = $json.Name
110109

111-
$isMatch = $false
112-
if ($IgnoreCase) {
113-
$isMatch = [string]::Equals($actual, $expected, [System.StringComparison]::OrdinalIgnoreCase)
114-
}
115-
else {
116-
$isMatch = [string]::Equals($actual, $expected, [System.StringComparison]::Ordinal)
110+
if ($actual -ne $actual.Trim()) {
111+
Write-Host "[MISMATCH] $relativePath"
112+
Write-Host " Reason : JSON Name has leading/trailing whitespace."
113+
Write-Host " File name : '$expected'"
114+
Write-Host " JSON Name : '$actual'"
115+
$errorCount++
116+
continue
117117
}
118118

119-
if (-not $isMatch) {
119+
if (-not [string]::Equals($actual, $expected, [System.StringComparison]::Ordinal)) {
120120
Write-Host "[MISMATCH] $relativePath"
121-
Write-Host " File name : $expected"
122-
Write-Host " JSON Name : $actual"
121+
Write-Host " File name : '$expected'"
122+
Write-Host " JSON Name : '$actual'"
123123
$errorCount++
124124
}
125125
}

0 commit comments

Comments
 (0)