@@ -86,33 +86,30 @@ Describe "Test importing correct customized rules" {
8686 $customizedRulePath.Count | Should Be 1
8787 }
8888
89- if (! $testingLibraryUsage )
90- {
91- It " will show the custom rule when given a rule folder path with trailing backslash" {
92- $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.RuleName -eq $measure }
93- $customizedRulePath.Count | Should Be 1
94- }
89+ It " will show the custom rule when given a rule folder path with trailing backslash" {
90+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.RuleName -eq $measure }
91+ $customizedRulePath.Count | Should Be 1
92+ }
9593
96- It " will show the custom rules when given a glob" {
97- $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -match $measure }
98- $customizedRulePath.Count | Should be 4
99- }
94+ It " will show the custom rules when given a glob" {
95+ $customizedRulePath = Get-ScriptAnalyzerRule - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -match $measure }
96+ $customizedRulePath.Count | Should be 4
97+ }
10098
101- It " will show the custom rules when given recurse switch" {
102- $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath " $directory \samplerule" , " $directory \samplerule\samplerule2" | Where-Object {$_.RuleName -eq $measure }
103- $customizedRulePath.Count | Should be 5
104- }
99+ It " will show the custom rules when given recurse switch" {
100+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath " $directory \samplerule" , " $directory \samplerule\samplerule2" | Where-Object {$_.RuleName -eq $measure }
101+ $customizedRulePath.Count | Should be 5
102+ }
105103
106- it " will show the custom rules when given glob with recurse switch" {
107- $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure }
108- $customizedRulePath.Count | Should be 5
109- }
110-
111- it " will show the custom rules when given glob with recurse switch" {
112- $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.RuleName -eq $measure }
113- $customizedRulePath.Count | Should be 3
114- }
104+ It " will show the custom rules when given glob with recurse switch" {
105+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure }
106+ $customizedRulePath.Count | Should be 5
115107 }
108+
109+ It " will show the custom rules when given glob with recurse switch" {
110+ $customizedRulePath = Get-ScriptAnalyzerRule - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.RuleName -eq $measure }
111+ $customizedRulePath.Count | Should be 3
112+ }
116113 }
117114
118115 Context " Test Invoke-ScriptAnalyzer with customized rules" {
@@ -126,33 +123,49 @@ Describe "Test importing correct customized rules" {
126123 $customizedRulePath.Count | Should Be 1
127124 }
128125
129- if (! $testingLibraryUsage )
126+ if (! $testingLibraryUsage )
130127 {
131- It " will show the custom rule in the results when given a rule folder path with trailing backslash" {
132- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.Message -eq $message }
133- $customizedRulePath.Count | Should Be 1
134- }
128+ It " will show the custom rule in the results when given a rule folder path with trailing backslash" {
129+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\ | Where-Object {$_.Message -eq $message }
130+ $customizedRulePath.Count | Should Be 1
131+ }
132+
133+ It " will show the custom rules when given a glob" {
134+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
135+ $customizedRulePath.Count | Should be 3
136+ }
137+
138+ It " will show the custom rules when given recurse switch" {
139+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule | Where-Object {$_.Message -eq $message }
140+ $customizedRulePath.Count | Should be 3
141+ }
142+
143+ It " will show the custom rules when given glob with recurse switch" {
144+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
145+ $customizedRulePath.Count | Should be 4
146+ }
147+
148+ It " will show the custom rules when given glob with recurse switch" {
149+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.Message -eq $message }
150+ $customizedRulePath.Count | Should be 3
151+ }
152+
153+ It " Using IncludeDefaultRules Switch with CustomRulePath" {
154+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomRulePath $directory \samplerule\samplerule.psm1 - IncludeDefaultRules
155+ $customizedRulePath.Count | Should Be 2
156+ }
135157
136- It " will show the custom rules when given a glob " {
137- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - CustomizedRulePath $directory \samplerule\samplerule * | Where-Object { $_ .Message -eq $message }
138- $customizedRulePath.Count | Should be 3
139- }
158+ It " Using IncludeDefaultRules Switch without CustomRulePath " {
159+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - IncludeDefaultRules
160+ $customizedRulePath.Count | Should Be 1
161+ }
140162
141- It " will show the custom rules when given recurse switch" {
142- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule | Where-Object {$_.Message -eq $message }
143- $customizedRulePath.Count | Should be 3
144- }
163+ It " Not Using IncludeDefaultRules Switch and without CustomRulePath" {
164+ $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1
165+ $customizedRulePath.Count | Should Be 1
166+ }
167+ }
145168
146- it " will show the custom rules when given glob with recurse switch" {
147- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule\samplerule* | Where-Object {$_.Message -eq $message }
148- $customizedRulePath.Count | Should be 4
149- }
150-
151- it " will show the custom rules when given glob with recurse switch" {
152- $customizedRulePath = Invoke-ScriptAnalyzer $directory \TestScript.ps1 - RecurseCustomRulePath - CustomizedRulePath $directory \samplerule* | Where-Object {$_.Message -eq $message }
153- $customizedRulePath.Count | Should be 3
154- }
155- }
156169 }
157170}
158171
0 commit comments