Skip to content

Commit dcead30

Browse files
🩹 [Patch]: Add suppression for long lines and improve formatting consistency in tests
1 parent e56de11 commit dcead30

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

‎scripts/tests/SourceCode/PSModule/PSModule.Tests.ps1‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
'PSAvoidUsingWriteHost', '',
1515
Justification = 'Logging to Github Actions.'
1616
)]
17+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
18+
'PSAvoidLongLines', '',
19+
Justification = 'Consistent formatting of ternary operator usage'
20+
)]
1721
[CmdLetBinding()]
1822
param(
1923
# The path to the 'src' folder of the repo.
@@ -40,8 +44,7 @@ BeforeAll {
4044
}
4145
Write-Host '::endgroup::'
4246
$privateFunctionsPath = Join-Path -Path $functionsPath -ChildPath 'private'
43-
$privateFunctionFiles = (Test-Path -Path $privateFunctionsPath) ?
44-
(Get-ChildItem -Path $privateFunctionsPath -File -Filter '*.ps1' -Recurse) : $null
47+
$privateFunctionFiles = (Test-Path -Path $privateFunctionsPath) ? (Get-ChildItem -Path $privateFunctionsPath -File -Filter '*.ps1' -Recurse) : $null
4548
Write-Host "::group:: - Private [$($privateFunctionFiles.Count)]"
4649
$privateFunctionFiles | ForEach-Object {
4750
Write-Host " - $($_.FullName)"
@@ -62,16 +65,14 @@ BeforeAll {
6265
}
6366
Write-Host '::endgroup::'
6467
$privateVariablesPath = Join-Path -Path $variablesPath -ChildPath 'private'
65-
$privateVariableFiles = (Test-Path -Path $privateVariablesPath) ?
66-
(Get-ChildItem -Path $privateVariablesPath -File -Filter '*.ps1' -Recurse) : $null
68+
$privateVariableFiles = (Test-Path -Path $privateVariablesPath) ? (Get-ChildItem -Path $privateVariablesPath -File -Filter '*.ps1' -Recurse) : $null
6769
Write-Host "::group:: - Private [$($privateVariableFiles.Count)]"
6870
$privateVariableFiles | ForEach-Object {
6971
Write-Host " - $($_.FullName)"
7072
}
7173
Write-Host '::endgroup::'
7274
$publicVariablesPath = Join-Path -Path $variablesPath -ChildPath 'public'
73-
$publicVariableFiles = (Test-Path -Path $publicVariablesPath) ?
74-
(Get-ChildItem -Path $publicVariablesPath -File -Filter '*.ps1' -Recurse) : $null
75+
$publicVariableFiles = (Test-Path -Path $publicVariablesPath) ? (Get-ChildItem -Path $publicVariablesPath -File -Filter '*.ps1' -Recurse) : $null
7576
Write-Host "::group:: - Public [$($publicVariableFiles.Count)]"
7677
$publicVariableFiles | ForEach-Object {
7778
Write-Host " - $($_.FullName)"
@@ -85,16 +86,18 @@ BeforeAll {
8586
}
8687
Write-Host '::endgroup::'
8788
$privateClassPath = Join-Path -Path $classPath -ChildPath 'private'
88-
$privateClassFiles = (Test-Path -Path $privateClassPath) ?
89-
(Get-ChildItem -Path $privateClassPath -File -Filter '*.ps1' -Recurse) : $null
89+
$privateClassFiles = (Test-Path -Path $privateClassPath) ? (Get-ChildItem -Path $privateClassPath -File -Filter '*.ps1' -Recurse) : $null
9090
Write-Host "::group:: - Private [$($privateClassFiles.Count)]"
9191
$privateClassFiles | ForEach-Object {
9292
Write-Host " - $($_.FullName)"
9393
}
9494
Write-Host '::endgroup::'
9595
$publicClassPath = Join-Path -Path $classPath -ChildPath 'public'
96-
$publicClassFiles = (Test-Path -Path $publicClassPath) ?
97-
(Get-ChildItem -Path $publicClassPath -File -Filter '*.ps1' -Recurse) : $null
96+
$publicClassFiles = if (Test-Path -Path $publicClassPath) {
97+
(Get-ChildItem -Path $publicClassPath -File -Filter '*.ps1' -Recurse)
98+
} else {
99+
$null
100+
}
98101
Write-Host "::group:: - Public [$($publicClassFiles.Count)]"
99102
$publicClassFiles | ForEach-Object {
100103
Write-Host " - $($_.FullName)"

0 commit comments

Comments
 (0)