Skip to content

Commit 1202f4e

Browse files
rjmholtbergmeister
authored andcommitted
Add PS 7 to UseCompatibleSyntax (PowerShell#1331)
* Add PS 7 to UseCompatibleSyntax * Update Rules/CompatibilityRules/UseCompatibleSyntax.cs Co-Authored-By: Christoph Bergmeister [MVP] <[email protected]>
1 parent e461f10 commit 1202f4e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Rules/CompatibilityRules/UseCompatibleSyntax.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ public class UseCompatibleSyntax : ConfigurableRule
2929

3030
private static readonly Version s_v6 = new Version(6,0);
3131

32+
private static readonly Version s_v7 = new Version(7,0);
33+
3234
private static readonly IReadOnlyList<Version> s_targetableVersions = new []
3335
{
3436
s_v3,
3537
s_v4,
3638
s_v5,
37-
s_v6
39+
s_v6,
40+
s_v7,
3841
};
3942

4043
/// <summary>
@@ -123,7 +126,7 @@ private static HashSet<Version> GetTargetedVersions(string[] versionSettings)
123126
{
124127
if (versionSettings == null || versionSettings.Length <= 0)
125128
{
126-
return new HashSet<Version>(){ s_v5, s_v6 };
129+
return new HashSet<Version>(){ s_v5, s_v6, s_v7 };
127130
}
128131

129132
var targetVersions = new HashSet<Version>();
@@ -278,7 +281,7 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
278281
{
279282
// Look for PowerShell workflows in the script
280283

281-
if (!_targetVersions.Contains(s_v6))
284+
if (!(_targetVersions.Contains(s_v6) || _targetVersions.Contains(s_v7)))
282285
{
283286
return AstVisitAction.Continue;
284287
}

0 commit comments

Comments
 (0)