@@ -27,85 +27,85 @@ Param(
27
27
28
28
BeforeAll {
29
29
$scriptFiles = Get-ChildItem - Path $Path - Include * .psm1, * .ps1 - Recurse - File
30
- " ::group:: - Script files [$ ( $scriptFiles.Count ) ]"
30
+ Write-Host " ::group:: - Script files [$ ( $scriptFiles.Count ) ]"
31
31
$scriptFiles | ForEach-Object {
32
32
Write-Host " - $ ( $_.FullName ) "
33
33
}
34
- ' ::endgroup::'
34
+ Write-Host ' ::endgroup::'
35
35
$functionsPath = Join-Path - Path $Path - ChildPath ' functions'
36
36
$functionFiles = (Test-Path - Path $functionsPath ) ? (Get-ChildItem - Path $functionsPath - File - Filter ' *.ps1' - Recurse) : $null
37
- " ::group:: - Function files [$ ( $functionFiles.Count ) ]"
37
+ Write-Host " ::group:: - Function files [$ ( $functionFiles.Count ) ]"
38
38
$functionFiles | ForEach-Object {
39
39
Write-Host " - $ ( $_.FullName ) "
40
40
}
41
- ' ::endgroup::'
41
+ Write-Host ' ::endgroup::'
42
42
$privateFunctionsPath = Join-Path - Path $functionsPath - ChildPath ' private'
43
43
$privateFunctionFiles = (Test-Path - Path $privateFunctionsPath ) ?
44
44
(Get-ChildItem - Path $privateFunctionsPath - File - Filter ' *.ps1' - Recurse) : $null
45
- " ::group:: - Private [$ ( $privateFunctionFiles.Count ) ]"
45
+ Write-Host " ::group:: - Private [$ ( $privateFunctionFiles.Count ) ]"
46
46
$privateFunctionFiles | ForEach-Object {
47
47
Write-Host " - $ ( $_.FullName ) "
48
48
}
49
- ' ::endgroup::'
49
+ Write-Host ' ::endgroup::'
50
50
$publicFunctionsPath = Join-Path - Path $functionsPath - ChildPath ' public'
51
51
$publicFunctionFiles = (Test-Path - Path $publicFunctionsPath ) ? (Get-ChildItem - Path $publicFunctionsPath - File - Filter ' *.ps1' - Recurse) : $null
52
- " ::group:: - Public [$ ( $publicFunctionFiles.Count ) ]"
52
+ Write-Host " ::group:: - Public [$ ( $publicFunctionFiles.Count ) ]"
53
53
$publicFunctionFiles | ForEach-Object {
54
54
Write-Host " - $ ( $_.FullName ) "
55
55
}
56
- ' ::endgroup::'
56
+ Write-Host ' ::endgroup::'
57
57
$variablesPath = Join-Path - Path $Path - ChildPath ' variables'
58
58
$variableFiles = (Test-Path - Path $variablesPath ) ? (Get-ChildItem - Path $variablesPath - File - Filter ' *.ps1' - Recurse) : $null
59
- " ::group:: - Variable files [$ ( $variableFiles.Count ) ]"
59
+ Write-Host " ::group:: - Variable files [$ ( $variableFiles.Count ) ]"
60
60
$variableFiles | ForEach-Object {
61
61
Write-Host " - $ ( $_.FullName ) "
62
62
}
63
- ' ::endgroup::'
63
+ Write-Host ' ::endgroup::'
64
64
$privateVariablesPath = Join-Path - Path $variablesPath - ChildPath ' private'
65
65
$privateVariableFiles = (Test-Path - Path $privateVariablesPath ) ?
66
66
(Get-ChildItem - Path $privateVariablesPath - File - Filter ' *.ps1' - Recurse) : $null
67
- " ::group:: - Private [$ ( $privateVariableFiles.Count ) ]"
67
+ Write-Host " ::group:: - Private [$ ( $privateVariableFiles.Count ) ]"
68
68
$privateVariableFiles | ForEach-Object {
69
69
Write-Host " - $ ( $_.FullName ) "
70
70
}
71
- ' ::endgroup::'
71
+ Write-Host ' ::endgroup::'
72
72
$publicVariablesPath = Join-Path - Path $variablesPath - ChildPath ' public'
73
73
$publicVariableFiles = (Test-Path - Path $publicVariablesPath ) ?
74
74
(Get-ChildItem - Path $publicVariablesPath - File - Filter ' *.ps1' - Recurse) : $null
75
- " ::group:: - Public [$ ( $publicVariableFiles.Count ) ]"
75
+ Write-Host " ::group:: - Public [$ ( $publicVariableFiles.Count ) ]"
76
76
$publicVariableFiles | ForEach-Object {
77
77
Write-Host " - $ ( $_.FullName ) "
78
78
}
79
- ' ::endgroup::'
79
+ Write-Host ' ::endgroup::'
80
80
$classPath = Join-Path - Path $Path - ChildPath ' classes'
81
81
$classFiles = (Test-Path - Path $classPath ) ? (Get-ChildItem - Path $classPath - File - Filter ' *.ps1' - Recurse) : $null
82
- " ::group:: - Class [$ ( $classFiles.Count ) ]"
82
+ Write-Host " ::group:: - Class [$ ( $classFiles.Count ) ]"
83
83
$classFiles | ForEach-Object {
84
84
Write-Host " - $ ( $_.FullName ) "
85
85
}
86
- ' ::endgroup::'
86
+ Write-Host ' ::endgroup::'
87
87
$privateClassPath = Join-Path - Path $classPath - ChildPath ' private'
88
88
$privateClassFiles = (Test-Path - Path $privateClassPath ) ?
89
89
(Get-ChildItem - Path $privateClassPath - File - Filter ' *.ps1' - Recurse) : $null
90
- " ::group:: - Private [$ ( $privateClassFiles.Count ) ]"
90
+ Write-Host " ::group:: - Private [$ ( $privateClassFiles.Count ) ]"
91
91
$privateClassFiles | ForEach-Object {
92
92
Write-Host " - $ ( $_.FullName ) "
93
93
}
94
- ' ::endgroup::'
94
+ Write-Host ' ::endgroup::'
95
95
$publicClassPath = Join-Path - Path $classPath - ChildPath ' public'
96
96
$publicClassFiles = (Test-Path - Path $publicClassPath ) ?
97
97
(Get-ChildItem - Path $publicClassPath - File - Filter ' *.ps1' - Recurse) : $null
98
- " ::group:: - Public [$ ( $publicClassFiles.Count ) ]"
98
+ Write-Host " ::group:: - Public [$ ( $publicClassFiles.Count ) ]"
99
99
$publicClassFiles | ForEach-Object {
100
100
Write-Host " - $ ( $_.FullName ) "
101
101
}
102
- ' ::endgroup::'
102
+ Write-Host ' ::endgroup::'
103
103
$testFiles = Get-ChildItem - Path $TestsPath - Include * .Tests.ps1 - Recurse - File
104
- " ::group:: - Test files [$ ( $testFiles.Count ) ]"
104
+ Write-Host " ::group:: - Test files [$ ( $testFiles.Count ) ]"
105
105
$testFiles | ForEach-Object {
106
106
Write-Host " - $ ( $_.FullName ) "
107
107
}
108
- ' ::endgroup::'
108
+ Write-Host ' ::endgroup::'
109
109
}
110
110
111
111
Describe ' PSModule - SourceCode tests' {
@@ -119,7 +119,7 @@ Describe 'PSModule - SourceCode tests' {
119
119
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:NumberOfProcessors:(?<Reason>.+)' - AllMatches
120
120
if ($skipTest.Matches.Count -gt 0 ) {
121
121
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
122
- " ::warning title=Skipping NumberOfProcessors test:: - $relativePath - $skipReason "
122
+ Write-Host " ::warning title=Skipping NumberOfProcessors test:: - $relativePath - $skipReason "
123
123
} else {
124
124
$issues += " - $ ( $_.Path ) :L$ ( $_.LineNumber ) "
125
125
}
@@ -136,7 +136,7 @@ Describe 'PSModule - SourceCode tests' {
136
136
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:Verbose:(?<Reason>.+)' - AllMatches
137
137
if ($skipTest.Matches.Count -gt 0 ) {
138
138
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
139
- " ::warning title=Skipping Verbose test:: - $relativePath - $skipReason "
139
+ Write-Host " ::warning title=Skipping Verbose test:: - $relativePath - $skipReason "
140
140
} else {
141
141
Select-String - Path $filePath - Pattern ' \s(-Verbose(?::\$true)?)\b(?!:\$false)' - AllMatches | ForEach-Object {
142
142
$issues += " - $relativePath `:L$ ( $_.LineNumber ) - $ ( $_.Line ) "
@@ -154,7 +154,7 @@ Describe 'PSModule - SourceCode tests' {
154
154
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:OutNull:(?<Reason>.+)' - AllMatches
155
155
if ($skipTest.Matches.Count -gt 0 ) {
156
156
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
157
- " ::warning title=Skipping OutNull test:: - $relativePath - $skipReason "
157
+ Write-Host " ::warning title=Skipping OutNull test:: - $relativePath - $skipReason "
158
158
} else {
159
159
Select-String - Path $filePath - Pattern ' Out-Null' - AllMatches | ForEach-Object {
160
160
$issues += " - $relativePath `:L$ ( $_.LineNumber ) - $ ( $_.Line ) "
@@ -172,7 +172,7 @@ Describe 'PSModule - SourceCode tests' {
172
172
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:NoTernary:(?<Reason>.+)' - AllMatches
173
173
if ($skipTest.Matches.Count -gt 0 ) {
174
174
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
175
- " ::warning title=Skipping NoTernary test:: - $relativePath - $skipReason "
175
+ Write-Host " ::warning title=Skipping NoTernary test:: - $relativePath - $skipReason "
176
176
} else {
177
177
Select-String - Path $filePath - Pattern ' (?<!\|)\s+\?\s' - AllMatches | ForEach-Object {
178
178
$issues += " - $relativePath `:L$ ( $_.LineNumber ) - $ ( $_.Line ) "
@@ -190,7 +190,7 @@ Describe 'PSModule - SourceCode tests' {
190
190
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:LowercaseKeywords:(?<Reason>.+)' - AllMatches
191
191
if ($skipTest.Matches.Count -gt 0 ) {
192
192
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
193
- " ::warning title=Skipping LowercaseKeywords test:: - $relativePath - $skipReason "
193
+ Write-Host " ::warning title=Skipping LowercaseKeywords test:: - $relativePath - $skipReason "
194
194
} else {
195
195
$errors = $null
196
196
$tokens = $null
@@ -246,7 +246,7 @@ Describe 'PSModule - SourceCode tests' {
246
246
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:FunctionCount:(?<Reason>.+)' - AllMatches
247
247
if ($skipTest.Matches.Count -gt 0 ) {
248
248
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
249
- " ::warning title=Skipping FunctionCount test:: - $relativePath - $skipReason "
249
+ Write-Host " ::warning title=Skipping FunctionCount test:: - $relativePath - $skipReason "
250
250
} else {
251
251
$Ast = [System.Management.Automation.Language.Parser ]::ParseFile($filePath , [ref ]$null , [ref ]$null )
252
252
$tokens = $Ast.FindAll ( { $args [0 ] -is [System.Management.Automation.Language.FunctionDefinitionAst ] } , $true )
@@ -267,7 +267,7 @@ Describe 'PSModule - SourceCode tests' {
267
267
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:FunctionName:(?<Reason>.+)' - AllMatches
268
268
if ($skipTest.Matches.Count -gt 0 ) {
269
269
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
270
- " ::warning title=Skipping FunctionName test:: - $relativePath - $skipReason "
270
+ Write-Host " ::warning title=Skipping FunctionName test:: - $relativePath - $skipReason "
271
271
} else {
272
272
$Ast = [System.Management.Automation.Language.Parser ]::ParseFile($filePath , [ref ]$null , [ref ]$null )
273
273
$tokens = $Ast.FindAll ( { $args [0 ] -is [System.Management.Automation.Language.FunctionDefinitionAst ] } , $true )
@@ -288,7 +288,7 @@ Describe 'PSModule - SourceCode tests' {
288
288
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:CmdletBinding:(?<Reason>.+)' - AllMatches
289
289
if ($skipTest.Matches.Count -gt 0 ) {
290
290
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
291
- " ::warning title=Skipping CmdletBinding test:: - $relativePath - $skipReason "
291
+ Write-Host " ::warning title=Skipping CmdletBinding test:: - $relativePath - $skipReason "
292
292
} else {
293
293
$scriptAst = [System.Management.Automation.Language.Parser ]::ParseFile($filePath , [ref ]$null , [ref ]$null )
294
294
$tokens = $scriptAst.FindAll ({ $true }, $true )
@@ -314,7 +314,7 @@ Describe 'PSModule - SourceCode tests' {
314
314
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:ParamBlock:(?<Reason>.+)' - AllMatches
315
315
if ($skipTest.Matches.Count -gt 0 ) {
316
316
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
317
- " ::warning title=Skipping ParamBlock test:: - $relativePath - $skipReason "
317
+ Write-Host " ::warning title=Skipping ParamBlock test:: - $relativePath - $skipReason "
318
318
} else {
319
319
$scriptAst = [System.Management.Automation.Language.Parser ]::ParseFile($filePath , [ref ]$null , [ref ]$null )
320
320
$tokens = $scriptAst.FindAll ({ $args [0 ] -is [System.Management.Automation.Language.ParamBlockAst ] }, $true )
@@ -366,7 +366,7 @@ Describe 'PSModule - SourceCode tests' {
366
366
$skipTest = Select-String - Path $filePath - Pattern ' #SkipTest:FunctionTest:(?<Reason>.+)' - AllMatches
367
367
if ($skipTest.Matches.Count -gt 0 ) {
368
368
$skipReason = $skipTest.Matches.Groups | Where-Object { $_.Name -eq ' Reason' } | Select-Object - ExpandProperty Value
369
- " ::warning title=Skipping FunctionTest test:: - $relativePath - $skipReason "
369
+ Write-Host " ::warning title=Skipping FunctionTest test:: - $relativePath - $skipReason "
370
370
} else {
371
371
$Ast = [System.Management.Automation.Language.Parser ]::ParseFile($filePath , [ref ]$null , [ref ]$null )
372
372
$tokens = $Ast.FindAll ( { $args [0 ] -is [System.Management.Automation.Language.FunctionDefinitionAst ] } , $true )
0 commit comments