File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,7 @@ private IEnumerable<DiagnosticRecord> FindInnerBraceViolations(TokenOperations t
243
243
|| ! IsPreviousTokenOnSameLine ( lCurly )
244
244
|| lCurly . Next . Value . Kind == TokenKind . NewLine
245
245
|| lCurly . Next . Value . Kind == TokenKind . LineContinuation
246
+ || lCurly . Next . Value . Kind == TokenKind . RCurly
246
247
)
247
248
{
248
249
continue ;
@@ -268,6 +269,7 @@ private IEnumerable<DiagnosticRecord> FindInnerBraceViolations(TokenOperations t
268
269
|| rCurly . Previous . Value . Kind == TokenKind . LCurly
269
270
|| rCurly . Previous . Value . Kind == TokenKind . NewLine
270
271
|| rCurly . Previous . Value . Kind == TokenKind . LineContinuation
272
+ || rCurly . Previous . Value . Kind == TokenKind . AtCurly
271
273
)
272
274
{
273
275
continue ;
Original file line number Diff line number Diff line change 327
327
$violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
328
328
Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '
329
329
}
330
-
331
- It " Should find a violation if there is more than 1 space inside empty curly braces" {
332
- $def = ' if($true) { }'
330
+
331
+ It " Should find a violation if there is more than 1 space after opening brace" {
332
+ $def = ' if($true) { Get-Item }'
333
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
334
+ Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '
335
+ }
336
+
337
+ It " Should find a violation if there is more than 1 space before closing brace" {
338
+ $def = ' if($true) { Get-Item }'
333
339
$violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
334
340
Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '
335
341
}
344
350
Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should - Be $null
345
351
}
346
352
353
+ It " Should not find a violation for an empty hashtable" {
354
+ $def = ' $hashtable = @{}'
355
+ Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should - Be $null
356
+ }
357
+
347
358
It " Should not find a violation if a new-line is after the opening brace" {
348
359
$def = @'
349
360
if ($true) {
You can’t perform that action at this time.
0 commit comments