File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change 1
1
Import-Module PSScriptAnalyzer
2
- $ruleName = " PSPlaceOpenBrace"
2
+ $settings = @ {
3
+ IncludeRules = @ (" PSPlaceOpenBrace" )
4
+ Rules = @ {
5
+ PSPlaceOpenBrace = @ {
6
+ Enable = $true
7
+ OnSameLine = $true
8
+ }
9
+ }
10
+ }
11
+
3
12
4
13
Describe " PlaceOpenBrace on same line" {
5
14
Context " When an open brace must be on the same line" {
@@ -10,7 +19,7 @@ function foo ($param1)
10
19
11
20
}
12
21
'@
13
- $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - IncludeRule $ruleName
22
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings
14
23
}
15
24
16
25
It " Should find a violation" {
@@ -29,18 +38,10 @@ function foo ($param1) {
29
38
30
39
}
31
40
'@
32
- $params = @ {
33
- ScriptDefinition = $def
34
- IncludeRule = $ruleName
35
- Settings = @ {
36
- rules = @ {
37
- PSPlaceOpenBrace = @ {
38
- OnSameLine = $false
39
- }
40
- }
41
- }
42
- }
43
- $violations = Invoke-ScriptAnalyzer @params
41
+
42
+ $settingsNewLine = $settings.Clone ()
43
+ $settingsNewLine [" Rules" ][" PSPlaceOpenBrace" ][" OnSameLine" ] = $false
44
+ $violations = Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settingsNewLine
44
45
}
45
46
46
47
It " Should find a violation" {
You can’t perform that action at this time.
0 commit comments