File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ private IEnumerable<DiagnosticRecord> FindHashtableViolations(TokenOperations to
154
154
}
155
155
}
156
156
157
+ #if ! PSV3
157
158
var configAsts = tokenOps . Ast . FindAll ( ast => ast is ConfigurationDefinitionAst , true ) ;
158
159
if ( configAsts != null )
159
160
{
@@ -169,7 +170,7 @@ private IEnumerable<DiagnosticRecord> FindHashtableViolations(TokenOperations to
169
170
groups . AddRange ( GetCommandElementExtentGroups ( configAst ) ) ;
170
171
}
171
172
}
172
-
173
+ #endif
173
174
174
175
// it is probably much easier have a hashtable writer that formats the hashtable and writes it
175
176
// but it makes handling comments hard. So we need to use this approach.
@@ -183,8 +184,6 @@ private IEnumerable<DiagnosticRecord> FindHashtableViolations(TokenOperations to
183
184
// find the distance between the assignment operators and their corresponding LHS
184
185
// find the longest left expression
185
186
// make sure all the assignment operators are in the same column as that of the longest left hand.
186
-
187
-
188
187
foreach ( var extentTuples in groups )
189
188
{
190
189
if ( ! HasPropertiesOnSeparateLines ( extentTuples ) )
Original file line number Diff line number Diff line change @@ -89,9 +89,10 @@ Configuration MyDscConfiguration {
89
89
}
90
90
}
91
91
92
- Context " When assignment statements are in DSC Configuration that has parse errors" {
93
- It " Sdhould find violations when assignment statements are not aligned" {
94
- $def = @'
92
+ if ($PSVersionTable.PSVersion.Major -ge 5 ) {
93
+ Context " When assignment statements are in DSC Configuration that has parse errors" {
94
+ It " Should find violations when assignment statements are not aligned" {
95
+ $def = @'
95
96
Configuration Sample_ChangeDescriptionAndPermissions
96
97
{
97
98
Import-DscResource -Module NonExistentModule
@@ -112,12 +113,13 @@ Configuration Sample_ChangeDescriptionAndPermissions
112
113
}
113
114
}
114
115
'@
115
- # This invocation will throw parse error caused by "Undefined DSC resource" because
116
- # NonExistentModule is not really avaiable to load. Therefore we set erroraction to
117
- # SilentlyContinue
118
- Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings - ErrorAction SilentlyContinue |
119
- Get-Count |
120
- Should Be 4
116
+ # This invocation will throw parse error caused by "Undefined DSC resource" because
117
+ # NonExistentModule is not really avaiable to load. Therefore we set erroraction to
118
+ # SilentlyContinue
119
+ Invoke-ScriptAnalyzer - ScriptDefinition $def - Settings $settings - ErrorAction SilentlyContinue |
120
+ Get-Count |
121
+ Should Be 4
122
+ }
121
123
}
122
124
}
123
125
}
You can’t perform that action at this time.
0 commit comments