File tree 2 files changed +12
-13
lines changed
2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -560,11 +560,6 @@ private Hashtable GetHashtableFromHashTableAst(HashtableAst hashTableAst)
560
560
}
561
561
}
562
562
563
- if ( rhsList . Count == 0 )
564
- {
565
- ThrowInvalidDataException ( kvp . Item2 ) ;
566
- }
567
-
568
563
output [ key ] = rhsList . ToArray ( ) ;
569
564
}
570
565
@@ -629,7 +624,7 @@ private List<string> GetArrayFromArrayExpressionAst(ArrayExpressionAst arrayExp)
629
624
}
630
625
}
631
626
632
- return null ;
627
+ return result ;
633
628
}
634
629
635
630
private void ThrowInvalidDataException ( Ast ast )
Original file line number Diff line number Diff line change @@ -38,19 +38,23 @@ Describe "Settings Precedence" {
38
38
39
39
Describe " Settings Class" {
40
40
Context " When an empty hashtable is provided" {
41
- BeforeAll {
42
- $settings = New-Object - TypeName $settingsTypeName - ArgumentList @ {}
43
- }
44
41
45
42
It " Should return empty <name> property" - TestCases @ (
46
43
@ { Name = " IncludeRules" }
47
44
@ { Name = " ExcludeRules" }
48
45
@ { Name = " Severity" }
49
46
@ { Name = " RuleArguments" }
50
- ) {
51
- Param ($Name )
47
+ ) {
48
+ Param ($Name )
52
49
53
- ${settings} .${Name}.Count | Should - Be 0
50
+ $settings = New-Object - TypeName $settingsTypeName - ArgumentList @ {}
51
+ ${settings} .${Name}.Count | Should - Be 0
52
+ }
53
+
54
+ It " Should be able to parse empty settings hashtable from settings file" {
55
+ $testPSSASettingsFilePath = " TestDrive:\PSSASettings.psd1"
56
+ Set-Content $testPSSASettingsFilePath - Value ' @{ExcludeRules = @()}'
57
+ Invoke-ScriptAnalyzer - ScriptDefinition ' gci' - Settings $testPSSASettingsFilePath | Should -Not - BeNullOrEmpty
54
58
}
55
59
}
56
60
@@ -104,7 +108,7 @@ Describe "Settings Class" {
104
108
It " Should return $expectedNumberOfIncludeRules IncludeRules" {
105
109
$settings.IncludeRules.Count | Should - Be $expectedNumberOfIncludeRules
106
110
}
107
-
111
+
108
112
$expectedNumberOfExcludeRules = 3
109
113
It " Should return $expectedNumberOfExcludeRules ExcludeRules" {
110
114
$settings.ExcludeRules.Count | Should - Be $expectedNumberOfExcludeRules
You can’t perform that action at this time.
0 commit comments