Skip to content

Commit 1e8aa16

Browse files
committed
a
1 parent 75a06a6 commit 1e8aa16

File tree

3 files changed

+19851
-32
lines changed

3 files changed

+19851
-32
lines changed

Engine/Helper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public bool IsDscResourceClassBased(ScriptBlockAst ast)
518518
return false;
519519
}
520520

521-
#if !(PSV3||PSV4)
521+
#if !(PSV3||PSV4)
522522

523523
List<string> dscResourceFunctionNames = new List<string>(new string[] { "Test", "Get", "Set" });
524524

@@ -534,7 +534,7 @@ item is TypeDefinitionAst
534534
return true;
535535
}
536536

537-
#endif
537+
#endif
538538

539539
return false;
540540
}
@@ -1074,7 +1074,7 @@ public string GetTypeFromMemberExpressionAst(MemberExpressionAst memberAst, Ast
10741074

10751075
#else
10761076

1077-
return GetTypeFromMemberExpressionAstHelper(memberAst, psClass, details);
1077+
return GetTypeFromMemberExpressionAstHelper(memberAst, psClass, details);
10781078

10791079
#endif
10801080
}
@@ -2027,7 +2027,7 @@ private static InvalidDataException CreateInvalidDataException(IScriptExtent ext
20272027
}
20282028

20292029

2030-
#endregion Methods
2030+
#endregion Methods
20312031
}
20322032

20332033

Tests/Rules/UseCompatibleTypes.Tests.ps1

Lines changed: 57 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ BeforeAll {
55
$script:RuleName = 'PSUseCompatibleTypes'
66
}
77

8-
$script:TargetProfileConfigKey = 'TargetProfiles'
9-
108
$script:Srv2012_3_profile = 'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
119
$script:Srv2012r2_4_profile = 'win-8_x64_6.3.9600.0_4.0_x64_4.0.30319.42000_framework'
1210
$script:Srv2016_5_profile = 'win-8_x64_10.0.14393.0_5.1.14393.2791_x64_4.0.30319.42000_framework'
@@ -79,11 +77,25 @@ Describe 'UseCompatibleTypes' {
7977
Rules = @{
8078
$script:RuleName = @{
8179
Enable = $true
82-
$script:TargetProfileConfigKey = @($Target)
80+
TargetProfiles = @(
81+
'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
82+
'win-8_x64_6.3.9600.0_4.0_x64_4.0.30319.42000_framework'
83+
'win-8_x64_10.0.14393.0_5.1.14393.2791_x64_4.0.30319.42000_framework'
84+
'win-8_x64_10.0.14393.0_6.2.4_x64_4.0.30319.42000_core'
85+
'win-8_x64_10.0.14393.0_7.0.0_x64_3.1.2_core'
86+
'win-8_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
87+
'win-8_x64_10.0.17763.0_6.2.4_x64_4.0.30319.42000_core'
88+
'win-8_x64_10.0.17763.0_7.0.0_x64_3.1.2_core'
89+
'win-48_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
90+
'win-4_x64_10.0.18362.0_6.2.4_x64_4.0.30319.42000_core'
91+
'win-4_x64_10.0.18362.0_7.0.0_x64_3.1.2_core'
92+
'ubuntu_x64_18.04_6.2.4_x64_4.0.30319.42000_core'
93+
'ubuntu_x64_18.04_7.0.0_x64_3.1.2_core'
94+
)
95+
)
8396
}
8497
}
8598
}
86-
8799
$diagnostics = Invoke-ScriptAnalyzer -IncludeRule $script:RuleName -ScriptDefinition $Script -Settings $settings
88100

89101
$diagnostics.Count | Should -Be $ProblemCount
@@ -104,7 +116,21 @@ Describe 'UseCompatibleTypes' {
104116
Rules = @{
105117
$script:RuleName = @{
106118
Enable = $true
107-
$script:TargetProfileConfigKey = @($Target)
119+
TargetProfiles = @(
120+
'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
121+
'win-8_x64_6.3.9600.0_4.0_x64_4.0.30319.42000_framework'
122+
'win-8_x64_10.0.14393.0_5.1.14393.2791_x64_4.0.30319.42000_framework'
123+
'win-8_x64_10.0.14393.0_6.2.4_x64_4.0.30319.42000_core'
124+
'win-8_x64_10.0.14393.0_7.0.0_x64_3.1.2_core'
125+
'win-8_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
126+
'win-8_x64_10.0.17763.0_6.2.4_x64_4.0.30319.42000_core'
127+
'win-8_x64_10.0.17763.0_7.0.0_x64_3.1.2_core'
128+
'win-48_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
129+
'win-4_x64_10.0.18362.0_6.2.4_x64_4.0.30319.42000_core'
130+
'win-4_x64_10.0.18362.0_7.0.0_x64_3.1.2_core'
131+
'ubuntu_x64_18.04_6.2.4_x64_4.0.30319.42000_core'
132+
'ubuntu_x64_18.04_7.0.0_x64_3.1.2_core'
133+
)
108134
}
109135
}
110136
}
@@ -130,16 +156,18 @@ Describe 'UseCompatibleTypes' {
130156
Rules = @{
131157
$script:RuleName = @{
132158
Enable = $true
133-
$script:TargetProfileConfigKey = @(
134-
$script:Srv2012_3_profile
135-
$script:Srv2012r2_4_profile
136-
$script:Srv2016_5_profile
137-
$script:Srv2016_6_2_profile
138-
$script:Srv2019_5_profile
139-
$script:Srv2019_6_2_profile
140-
$script:Win10_5_profile
141-
$script:Win10_6_2_profile
142-
$script:Ubuntu1804_6_2_profile
159+
TargetProfiles = @(
160+
'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
161+
'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
162+
'win-8_x64_6.3.9600.0_4.0_x64_4.0.30319.42000_framework'
163+
'win-8_x64_10.0.14393.0_5.1.14393.2791_x64_4.0.30319.42000_framework'
164+
'win-8_x64_10.0.14393.0_6.2.4_x64_4.0.30319.42000_core'
165+
'win-8_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
166+
'win-8_x64_10.0.17763.0_6.2.4_x64_4.0.30319.42000_core'
167+
'win-48_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
168+
'win-4_x64_10.0.18362.0_6.2.4_x64_4.0.30319.42000_core'
169+
'win-4_x64_10.0.18362.0_7.0.0_x64_3.1.2_core'
170+
'ubuntu_x64_18.04_6.2.4_x64_4.0.30319.42000_core'
143171
)
144172
}
145173
}
@@ -163,18 +191,19 @@ Describe 'UseCompatibleTypes' {
163191
Rules = @{
164192
$script:RuleName = @{
165193
Enable = $true
166-
$script:TargetProfileConfigKey = @(
167-
$script:Srv2012_3_profile
168-
$script:Srv2012r2_4_profile
169-
$script:Srv2016_5_profile
170-
$script:Srv2016_6_2_profile
171-
$script:Srv2019_7_profile
172-
$script:Srv2019_5_profile
173-
$script:Srv2019_6_2_profile
174-
$script:Win10_5_profile
175-
$script:Win10_6_2_profile
176-
$script:Ubuntu1804_6_2_profile
177-
$script:Ubuntu1804_7_profile
194+
TargetProfiles = @(
195+
'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
196+
'win-8_x64_6.2.9200.0_3.0_x64_4.0.30319.42000_framework'
197+
'win-8_x64_6.3.9600.0_4.0_x64_4.0.30319.42000_framework'
198+
'win-8_x64_10.0.14393.0_5.1.14393.2791_x64_4.0.30319.42000_framework'
199+
'win-8_x64_10.0.14393.0_6.2.4_x64_4.0.30319.42000_core'
200+
'win-8_x64_10.0.14393.0_7.0.0_x64_3.1.2_core'
201+
'win-8_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
202+
'win-8_x64_10.0.17763.0_6.2.4_x64_4.0.30319.42000_core'
203+
'win-48_x64_10.0.17763.0_5.1.17763.316_x64_4.0.30319.42000_framework'
204+
'win-4_x64_10.0.18362.0_6.2.4_x64_4.0.30319.42000_core'
205+
'ubuntu_x64_18.04_6.2.4_x64_4.0.30319.42000_core'
206+
'ubuntu_x64_18.04_7.0.0_x64_3.1.2_core'
178207
)
179208
IgnoreTypes = @('System.IO.Compression.ZipFile')
180209
}
@@ -192,7 +221,7 @@ Describe 'UseCompatibleTypes' {
192221
Rules = @{
193222
$script:RuleName = @{
194223
Enable = $true
195-
$script:TargetProfileConfigKey = @(
224+
TargetProfiles = @(
196225
$script:AzF_profile
197226
$script:AzA_profile
198227
$script:Win10_5_profile

0 commit comments

Comments
 (0)