Skip to content

Commit 8951ce9

Browse files
Remove obsolete ternary compatibility test
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent fb1bdb8 commit 8951ce9

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

.github/actions/Test-PSModule/src/tests/SourceCode/PSModule/PSModule.Tests.ps1

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,6 @@ Describe 'PSModule - SourceCode tests' {
163163
$issues -join [Environment]::NewLine |
164164
Should -BeNullOrEmpty -Because "the script should use '`$null = ...' instead of '... | Out-Null'"
165165
}
166-
It 'Should not use ternary operations for compatibility reasons (ID: NoTernary)' -Skip {
167-
$issues = @('')
168-
$scriptFiles | ForEach-Object {
169-
$filePath = $_.FullName
170-
$relativePath = $filePath.Replace($Path, '').Trim('\').Trim('/')
171-
$skipTest = Select-String -Path $filePath -Pattern '#SkipTest:NoTernary:(?<Reason>.+)' -AllMatches
172-
if ($skipTest.Matches.Count -gt 0) {
173-
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq 'Reason' } | Select-Object -ExpandProperty Value
174-
Write-Host "::warning title=Skipping NoTernary test:: - $relativePath - $skipReason"
175-
} else {
176-
Select-String -Path $filePath -Pattern '(?<!\|)\s+\?\s' -AllMatches | ForEach-Object {
177-
$issues += " - $relativePath`:L$($_.LineNumber) - $($_.Line)"
178-
}
179-
}
180-
}
181-
$issues -join [Environment]::NewLine |
182-
Should -BeNullOrEmpty -Because 'the script should not use ternary operations for compatibility with PS 5.1 and below'
183-
}
184166
It 'all powershell keywords are lowercase (ID: LowercaseKeywords)' {
185167
$issues = @('')
186168
$scriptFiles | ForEach-Object {

0 commit comments

Comments
 (0)