File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 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
243243 || ! IsPreviousTokenOnSameLine ( lCurly )
244244 || lCurly . Next . Value . Kind == TokenKind . NewLine
245245 || lCurly . Next . Value . Kind == TokenKind . LineContinuation
246+ || lCurly . Next . Value . Kind == TokenKind . RCurly
246247 )
247248 {
248249 continue ;
@@ -268,6 +269,7 @@ private IEnumerable<DiagnosticRecord> FindInnerBraceViolations(TokenOperations t
268269 || rCurly . Previous . Value . Kind == TokenKind . LCurly
269270 || rCurly . Previous . Value . Kind == TokenKind . NewLine
270271 || rCurly . Previous . Value . Kind == TokenKind . LineContinuation
272+ || rCurly . Previous . Value . Kind == TokenKind . AtCurly
271273 )
272274 {
273275 continue ;
Original file line number Diff line number Diff line change 327327 $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
328328 Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '
329329 }
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 }'
333339 $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
334340 Test-CorrectionExtentFromContent $def $violations 1 ' ' ' '
335341 }
344350 Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings | Should - Be $null
345351 }
346352
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+
347358 It " Should not find a violation if a new-line is after the opening brace" {
348359 $def = @'
349360if ($true) {
You can’t perform that action at this time.
0 commit comments