From d44244a6eb17d786021605a30b796ad15d2e17e6 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Tue, 10 Sep 2019 10:36:05 -0700 Subject: [PATCH 1/2] Add PS 7 to UseCompatibleSyntax --- Rules/CompatibilityRules/UseCompatibleSyntax.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Rules/CompatibilityRules/UseCompatibleSyntax.cs b/Rules/CompatibilityRules/UseCompatibleSyntax.cs index 22f44b86f..7173e3588 100644 --- a/Rules/CompatibilityRules/UseCompatibleSyntax.cs +++ b/Rules/CompatibilityRules/UseCompatibleSyntax.cs @@ -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 s_targetableVersions = new [] { s_v3, s_v4, s_v5, - s_v6 + s_v6, + s_v7 }; /// @@ -123,7 +126,7 @@ private static HashSet GetTargetedVersions(string[] versionSettings) { if (versionSettings == null || versionSettings.Length <= 0) { - return new HashSet(){ s_v5, s_v6 }; + return new HashSet(){ s_v5, s_v6, s_v7 }; } var targetVersions = new HashSet(); @@ -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; } From 38c8b8ca67f8beda6752bfd85f00e9991e4fc892 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Tue, 10 Sep 2019 14:00:18 -0700 Subject: [PATCH 2/2] Update Rules/CompatibilityRules/UseCompatibleSyntax.cs Co-Authored-By: Christoph Bergmeister [MVP] --- Rules/CompatibilityRules/UseCompatibleSyntax.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rules/CompatibilityRules/UseCompatibleSyntax.cs b/Rules/CompatibilityRules/UseCompatibleSyntax.cs index 7173e3588..fc063f3ff 100644 --- a/Rules/CompatibilityRules/UseCompatibleSyntax.cs +++ b/Rules/CompatibilityRules/UseCompatibleSyntax.cs @@ -37,7 +37,7 @@ public class UseCompatibleSyntax : ConfigurableRule s_v4, s_v5, s_v6, - s_v7 + s_v7, }; ///