@@ -41,8 +41,7 @@ if ($true){}
41
41
$def = @'
42
42
if($true) {}
43
43
'@
44
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
45
- $violations.Count | Should Be 0
44
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
46
45
}
47
46
48
47
It " Should not find violation if an open brace follows a foreach member invocation" {
@@ -83,8 +82,7 @@ function foo($param1) {
83
82
84
83
}
85
84
'@
86
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
87
- $violations.Count | Should Be 0
85
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
88
86
}
89
87
90
88
It " Should not find a violation in a param block" {
@@ -93,8 +91,7 @@ function foo() {
93
91
param( )
94
92
}
95
93
'@
96
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
97
- $violations.Count | Should Be 0
94
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
98
95
}
99
96
100
97
It " Should not find a violation in a nested open paren" {
@@ -103,16 +100,14 @@ function foo($param) {
103
100
((Get-Process))
104
101
}
105
102
'@
106
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
107
- $violations.Count | Should Be 0
103
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
108
104
}
109
105
110
106
It " Should not find a violation on a method call" {
111
107
$def = @'
112
108
$x.foo("bar")
113
109
'@
114
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
115
- $violations.Count | Should Be 0
110
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
116
111
}
117
112
}
118
113
@@ -162,16 +157,14 @@ $x = @"
162
157
"abc"
163
158
"@
164
159
'@
165
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
166
- $violations.Count | Should Be 0
160
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
167
161
}
168
162
169
163
It " Should not find violation if there are whitespaces of size 1 around an assignment operator for here string" {
170
164
$def = @'
171
165
$x = 1
172
166
'@
173
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
174
- $violations.Count | Should Be 0
167
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
175
168
}
176
169
177
170
It " Should not find violation if there are no whitespaces around DotDot operator" {
@@ -202,8 +195,7 @@ $x = @(1,2)
202
195
$def = @'
203
196
$x = @(1, 2)
204
197
'@
205
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
206
- $violations.Count | Should Be 0
198
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
207
199
}
208
200
}
209
201
@@ -227,8 +219,7 @@ $x = @{a=1;b=2}
227
219
$def = @'
228
220
$x = @{a=1; b=2}
229
221
'@
230
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
231
- $violations.Count | Should Be 0
222
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
232
223
}
233
224
234
225
It " Should not find a violation if a new-line follows a semi-colon" {
@@ -238,16 +229,14 @@ $x = @{
238
229
b=2
239
230
}
240
231
'@
241
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
242
- $violations.Count | Should Be 0
232
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
243
233
}
244
234
245
235
It " Should not find a violation if a end of input follows a semi-colon" {
246
236
$def = @'
247
237
$x = "abc";
248
238
'@
249
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
250
- $violations.Count | Should Be 0
239
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should Be $null
251
240
}
252
241
253
242
0 commit comments