Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PS 7 to UseCompatibleSyntax #1331

Merged
merged 2 commits into from
Oct 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Rules/CompatibilityRules/UseCompatibleSyntax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ public class UseCompatibleSyntax : ConfigurableRule

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

private static readonly Version s_v7 = new Version(7,0);

private static readonly IReadOnlyList<Version> s_targetableVersions = new []
{
s_v3,
s_v4,
s_v5,
s_v6
s_v6,
s_v7
rjmholt marked this conversation as resolved.
Show resolved Hide resolved
};

/// <summary>
Expand Down Expand Up @@ -123,7 +126,7 @@ private static HashSet<Version> GetTargetedVersions(string[] versionSettings)
{
if (versionSettings == null || versionSettings.Length <= 0)
{
return new HashSet<Version>(){ s_v5, s_v6 };
return new HashSet<Version>(){ s_v5, s_v6, s_v7 };
}

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

if (!_targetVersions.Contains(s_v6))
if (!(_targetVersions.Contains(s_v6) || _targetVersions.Contains(s_v7)))
{
return AstVisitAction.Continue;
}
Expand Down