@@ -83,7 +83,22 @@ Describe "Testing module and cmdlets against PSSA rules" -Tag Linting -WarningAc
8383 foreach ($rule in $scriptAnalyzerRules ) {
8484 It " should pass $rule " {
8585 If ($analysis.RuleName -contains $rule ) {
86- $analysis | Where RuleName -eq $rule - OutVariable failures
86+ $analysis | Where-Object RuleName -eq $rule - OutVariable failures
87+ $failures.Count | Should - Be 0
88+ }
89+ }
90+ }
91+ }
92+
93+ Context " $_ test against InjectionHunter rules" {
94+ $injectionHunterModulePath = Get-Module - Name InjectionHunter - ListAvailable | Select-Object - ExpandProperty Path
95+
96+ $analysis = Invoke-ScriptAnalyzer - Path $_.FullName - CustomRulePath $injectionHunterModulePath
97+
98+ foreach ($rule in $scriptAnalyzerRules ) {
99+ It " should pass $rule " {
100+ If ($analysis.RuleName -contains $rule ) {
101+ $analysis | Where-Object RuleName -eq $rule - OutVariable failures
87102 $failures.Count | Should - Be 0
88103 }
89104 }
@@ -98,7 +113,22 @@ Describe "Testing module and cmdlets against PSSA rules" -Tag Linting -WarningAc
98113 foreach ($rule in $scriptAnalyzerRules ) {
99114 It " should pass $rule " {
100115 If ($analysis.RuleName -contains $rule ) {
101- $analysis | Where RuleName -eq $rule - OutVariable failures
116+ $analysis | Where-Object RuleName -eq $rule - OutVariable failures
117+ $failures.Count | Should - Be 0
118+ }
119+ }
120+ }
121+ }
122+
123+ Context " $_ test against InjectionHunter rules" {
124+ $injectionHunterModulePath = Get-Module - Name InjectionHunter - ListAvailable | Select-Object - ExpandProperty Path
125+
126+ $analysis = Invoke-ScriptAnalyzer - Path $_.FullName - CustomRulePath $injectionHunterModulePath
127+
128+ foreach ($rule in $scriptAnalyzerRules ) {
129+ It " should pass $rule " {
130+ If ($analysis.RuleName -contains $rule ) {
131+ $analysis | Where-Object RuleName -eq $rule - OutVariable failures
102132 $failures.Count | Should - Be 0
103133 }
104134 }
0 commit comments