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 = @{
3
3
Enable = $true
4
4
OnSameLine = $true
5
5
NewLineAfter = $true
6
+ IgnoreOneLineIf = $true
6
7
}
7
8
8
9
$settings = @ {
@@ -42,7 +43,7 @@ function foo ($param1) {
42
43
}
43
44
'@
44
45
$ruleConfiguration .' OnSameLine' = $false
45
- $ruleConfiguration .' NewLineAfter' = $true
46
+ $ruleConfiguration .' NewLineAfter' = $true
46
47
$violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
47
48
$defShouldIgnore = @'
48
49
Get-Process | % { "blah" }
@@ -61,6 +62,15 @@ Get-Process | % { "blah" }
61
62
It " Should ignore violations for a command element" {
62
63
$violationsShouldIgnore.Count | Should Be 0
63
64
}
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
+ }
64
74
}
65
75
66
76
Context " When a new line should follow an open brace" {
You can’t perform that action at this time.
0 commit comments