From 14d80426c5b81cb21f55d8d90fd3028a49f7e8f4 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 21 Dec 2024 21:22:31 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=B2=20[Fix]:=20Fix=20skip=20when=20mul?= =?UTF-8?q?tiple=20skips=20are=20found=20(#86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description - Fix skip when multiple skips are found ## Type of change - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas --- scripts/tests/PSModule/SourceCode.Tests.ps1 | 130 ++++++++++---------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/scripts/tests/PSModule/SourceCode.Tests.ps1 b/scripts/tests/PSModule/SourceCode.Tests.ps1 index ffb2a9e..bbed244 100644 --- a/scripts/tests/PSModule/SourceCode.Tests.ps1 +++ b/scripts/tests/PSModule/SourceCode.Tests.ps1 @@ -111,9 +111,9 @@ Describe 'PSModule - SourceCode tests' { if ($skipTest.Matches.Count -gt 0) { $skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq 'Reason' } | Select-Object -ExpandProperty Value Write-GitHubWarning -Message " - $relativePath - $skipReason" -Title 'Skipping NumberOfProcessors test' - continue + } else { + $issues += " - $($_.Path):L$($_.LineNumber)" } - $issues += " - $($_.Path):L$($_.LineNumber)" } } $issues -join [Environment]::NewLine | @@ -128,10 +128,10 @@ Describe 'PSModule - SourceCode tests' { if ($skipTest.Matches.Count -gt 0) { $skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq 'Reason' } | Select-Object -ExpandProperty Value Write-GitHubWarning -Message " - $relativePath - $skipReason" -Title 'Skipping Verbose test' - continue - } - Select-String -Path $filePath -Pattern '\s(-Verbose(?::\$true)?)\b(?!:\$false)' -AllMatches | ForEach-Object { - $issues += " - $relativePath`:L$($_.LineNumber) - $($_.Line)" + } else { + Select-String -Path $filePath -Pattern '\s(-Verbose(?::\$true)?)\b(?!:\$false)' -AllMatches | ForEach-Object { + $issues += " - $relativePath`:L$($_.LineNumber) - $($_.Line)" + } } } $issues -join [Environment]::NewLine | @@ -146,10 +146,10 @@ Describe 'PSModule - SourceCode tests' { if ($skipTest.Matches.Count -gt 0) { $skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq 'Reason' } | Select-Object -ExpandProperty Value Write-GitHubWarning -Message " - $relativePath - $skipReason" -Title 'Skipping OutNull test' - continue - } - Select-String -Path $filePath -Pattern 'Out-Null' -AllMatches | ForEach-Object { - $issues += " - $relativePath`:L$($_.LineNumber) - $($_.Line)" + } else { + Select-String -Path $filePath -Pattern 'Out-Null' -AllMatches | ForEach-Object { + $issues += " - $relativePath`:L$($_.LineNumber) - $($_.Line)" + } } } $issues -join [Environment]::NewLine | @@ -164,10 +164,10 @@ Describe 'PSModule - SourceCode tests' { if ($skipTest.Matches.Count -gt 0) { $skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq 'Reason' } | Select-Object -ExpandProperty Value Write-GitHubWarning -Message " - $relativePath - $skipReason" -Title 'Skipping NoTernary test' - continue - } - Select-String -Path $filePath -Pattern '(?