File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ $ruleConfiguration = @{
33 Enable = $true
44 OnSameLine = $true
55 NewLineAfter = $true
6+ IgnoreOneLineIf = $true
67}
78
89$settings = @ {
@@ -42,7 +43,7 @@ function foo ($param1) {
4243}
4344'@
4445 $ruleConfiguration .' OnSameLine' = $false
45- $ruleConfiguration .' NewLineAfter' = $true
46+ $ruleConfiguration .' NewLineAfter' = $true
4647 $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
4748 $defShouldIgnore = @'
4849Get-Process | % { "blah" }
@@ -61,6 +62,15 @@ Get-Process | % { "blah" }
6162 It " Should ignore violations for a command element" {
6263 $violationsShouldIgnore.Count | Should Be 0
6364 }
65+
66+ It " Should ignore violations for one line if statement" {
67+ $def = @'
68+ $x = if ($true) { "blah" } else { "blah blah" }
69+ '@
70+ $ruleConfiguration .' IgnoreOneLineIf' = $true
71+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
72+ $violations.Count | Should Be 0
73+ }
6474 }
6575
6676 Context " When a new line should follow an open brace" {
You can’t perform that action at this time.
0 commit comments