@@ -61,39 +61,36 @@ BeforeDiscovery {
6161 )
6262 }
6363 }
64- }
65-
66- Describe ' PSScriptAnalyzer' {
67- BeforeAll {
68- $relativeSettingsFilePath = if ($SettingsFilePath.StartsWith ($PSScriptRoot )) {
69- $SettingsFilePath.Replace ($PSScriptRoot , ' Action:' ).Trim(' \' ).Trim(' /' )
70- } elseif ($SettingsFilePath.StartsWith ($env: GITHUB_WORKSPACE )) {
71- $SettingsFilePath.Replace ($env: GITHUB_WORKSPACE , ' Workspace:' ).Trim(' \' ).Trim(' /' )
72- } else {
73- $SettingsFilePath
74- }
75- [pscustomobject ]@ {
76- relativeSettingsFilePath = $relativeSettingsFilePath
77- SettingsFilePath = $SettingsFilePath
78- PSScriptRoot = $PSScriptRoot
79- GITHUB_WORKSPACE = $env: GITHUB_WORKSPACE
80- }
81- LogGroup " Invoke-ScriptAnalyzer -Path [$Path ] -Settings [$relativeSettingsFilePath ]" {
82- $testResults = Invoke-ScriptAnalyzer - Path $Path - Settings $SettingsFilePath - Recurse - Verbose
83- }
84- LogGroup " TestResults [$ ( $testResults.Count ) ]" {
85- $testResults | ForEach-Object {
86- $_ | Format-List | Out-String - Stream | ForEach-Object {
87- Write-Verbose $_ - Verbose
88- }
64+ $relativeSettingsFilePath = if ($SettingsFilePath.StartsWith ($PSScriptRoot )) {
65+ $SettingsFilePath.Replace ($PSScriptRoot , ' Action:' ).Trim(' \' ).Trim(' /' )
66+ } elseif ($SettingsFilePath.StartsWith ($env: GITHUB_WORKSPACE )) {
67+ $SettingsFilePath.Replace ($env: GITHUB_WORKSPACE , ' Workspace:' ).Trim(' \' ).Trim(' /' )
68+ } else {
69+ $SettingsFilePath
70+ }
71+ [pscustomobject ]@ {
72+ relativeSettingsFilePath = $relativeSettingsFilePath
73+ SettingsFilePath = $SettingsFilePath
74+ PSScriptRoot = $PSScriptRoot
75+ GITHUB_WORKSPACE = $env: GITHUB_WORKSPACE
76+ }
77+ LogGroup " Invoke-ScriptAnalyzer -Path [$Path ] -Settings [$relativeSettingsFilePath ]" {
78+ $testResults = Invoke-ScriptAnalyzer - Path $Path - Settings $SettingsFilePath - Recurse - Verbose
79+ }
80+ LogGroup " TestResults [$ ( $testResults.Count ) ]" {
81+ $testResults | ForEach-Object {
82+ $_ | Format-List | Out-String - Stream | ForEach-Object {
83+ Write-Verbose $_ - Verbose
8984 }
9085 }
9186 }
87+ }
9288
89+ Describe ' PSScriptAnalyzer' {
9390 foreach ($Severety in $Severeties ) {
9491 Context " Severity: $Severety " {
9592 foreach ($rule in $rules | Where-Object - Property Severity -EQ $Severety ) {
96- It " $ ( $rule.CommonName ) ($ ( $rule.RuleName ) )" - Skip:$rule.Skip - ForEach $rule {
93+ It " $ ( $rule.CommonName ) ($ ( $rule.RuleName ) )" - Skip:$rule.Skip {
9794 $issues = [Collections.Generic.List [string ]]::new()
9895 $testResults | Where-Object - Property RuleName -EQ $rule.RuleName | ForEach-Object {
9996 $relativePath = $_.ScriptPath.Replace ($Path , ' ' ).Trim(' \' ).Trim(' /' )
0 commit comments