@@ -108,7 +108,7 @@ Describe "Test importing correct customized rules" {
108
108
109
109
It " will show the custom rules when given glob with recurse switch" {
110
110
$customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.RuleName -eq $measure }
111
- $customizedRulePath.Count | Should be 4
111
+ $customizedRulePath.Count | Should be 3
112
112
}
113
113
}
114
114
@@ -147,7 +147,7 @@ Describe "Test importing correct customized rules" {
147
147
148
148
It " will show the custom rules when given glob with recurse switch" {
149
149
$customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.Message -eq $message }
150
- $customizedRulePath.Count | Should be 4
150
+ $customizedRulePath.Count | Should be 3
151
151
}
152
152
153
153
It " Using IncludeDefaultRules Switch with CustomRulePath" {
@@ -164,23 +164,26 @@ Describe "Test importing correct customized rules" {
164
164
$customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1
165
165
$customizedRulePath.Count | Should Be 1
166
166
}
167
+
168
+ if ($PSVersionTable.PSVersion -ge [Version ]' 5.0' )
169
+ {
170
+ It " loads custom rules that contain version in their path" {
171
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \VersionedSampleRule\SampleRuleWithVersion
172
+ $customizedRulePath.Count | Should Be 1
167
173
168
- It " loads custom rules that contain version in their path" {
169
- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \SampleRuleWithVersion\SampleRuleWithVersion
170
- $customizedRulePath.Count | Should Be 1
171
-
172
- $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \SampleRuleWithVersion\SampleRuleWithVersion
173
- $customizedRulePath.Count | Should Be 1
174
- }
174
+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \VersionedSampleRulen\SampleRuleWithVersion
175
+ $customizedRulePath.Count | Should Be 1
176
+ }
175
177
176
- It " loads custom rules that contain version in their path with the RecurseCustomRule switch" {
177
- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \SampleRuleWithVersion - RecurseCustomRulePath
178
- $customizedRulePath.Count | Should Be 1
178
+ It " loads custom rules that contain version in their path with the RecurseCustomRule switch" {
179
+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \VersionedSampleRulen - RecurseCustomRulePath
180
+ $customizedRulePath.Count | Should Be 1
179
181
180
- $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \SampleRuleWithVersion - RecurseCustomRulePath
181
- $customizedRulePath.Count | Should Be 1
182
+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomRulePath $directory \VersionedSampleRulen - RecurseCustomRulePath
183
+ $customizedRulePath.Count | Should Be 1
182
184
183
- }
185
+ }
186
+ }
184
187
}
185
188
186
189
}
0 commit comments