Skip to content

Commit f1222ef

Browse files
authored
Add CommandData files of PowerShell Core 6.0.2 for Windows/Linux/macOS and WMF3/4 that are used by UseCompatibleCmdlets rule (#954)
* add typedate for pwsh 6.0.2 on Windows 10.0.16299.251 and for Linux from Ubuntu 16 (LTS) * update docs and remove old alpha versions for windows/linux * add v3 command data file from Tyler. And add v5.1 to docs as well * add wmf4 command data file produced on new vanilla winserver2012r2 azure machine * add mac command data file from James and correct it from osx to macOs
1 parent c632ea1 commit f1222ef

13 files changed

+18780
-5887
lines changed

Engine/Settings/core-6.0.0-alpha-linux.json

Lines changed: 0 additions & 1821 deletions
This file was deleted.

Engine/Settings/core-6.0.0-alpha-osx.json

Lines changed: 0 additions & 1821 deletions
This file was deleted.

Engine/Settings/core-6.0.0-alpha-windows.json

Lines changed: 0 additions & 2238 deletions
This file was deleted.

Engine/Settings/core-6.0.2-linux.json

Lines changed: 1648 additions & 0 deletions
Large diffs are not rendered by default.

Engine/Settings/core-6.0.2-macos.json

Lines changed: 1648 additions & 0 deletions
Large diffs are not rendered by default.

Engine/Settings/core-6.0.2-windows.json

Lines changed: 2075 additions & 0 deletions
Large diffs are not rendered by default.

Engine/Settings/desktop-3.0-windows.json

Lines changed: 6268 additions & 0 deletions
Large diffs are not rendered by default.

Engine/Settings/desktop-4.0-windows.json

Lines changed: 7133 additions & 0 deletions
Large diffs are not rendered by default.

RuleDocumentation/UseCompatibleCmdlets.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
## Description
66

7-
This rule flags cmdlets that are not available in a given Edition/Version of PowerShell on a given Operating System. It works by comparing a cmdlet against a set of whitelists which ship with PSScriptAnalyzer. They can be found at `/path/to/PSScriptAnalyzerModule/Settings`. These files are of the form, `PSEDITION-PSVERSION-OS.json` where `PSEDITION` can be either `core` or `desktop`, `OS` can be either `windows`, `linux` or `osx`, and `version` is the PowerShell version. To enable the rule to check if your script is compatible on PowerShell Core on windows, put the following your settings file:
7+
This rule flags cmdlets that are not available in a given Edition/Version of PowerShell on a given Operating System. It works by comparing a cmdlet against a set of whitelists which ship with PSScriptAnalyzer. They can be found at `/path/to/PSScriptAnalyzerModule/Settings`. These files are of the form, `PSEDITION-PSVERSION-OS.json` where `PSEDITION` can be either `Core` or `Desktop`, `OS` can be either `Windows`, `Linux` or `MacOS`, and `Version` is the PowerShell version. To enable the rule to check if your script is compatible on PowerShell Core on windows, put the following your settings file:
8+
89
```PowerShell
910
@{
1011
'Rules' = @{
1112
'PSUseCompatibleCmdlets' = @{
12-
'compatibility' = @("core-6.0.0-alpha-windows")
13+
'compatibility' = @("core-6.0.2-windows")
1314
}
1415
}
1516
}
1617
```
1718

18-
The parameter `compatibility` is a list that contain any of the following `{core-6.0.0-alpha-windows, core-6.0.0-alpha-linux, core-6.0.0-alpha-osx}`.
19+
The parameter `compatibility` is a list that contain any of the following `{desktop-3.0-windows, desktop-4.0-windows, desktop-5.1.14393.206-windows, core-6.0.2-windows, core-6.0.2-linux, core-6.0.2-macos}`.

Rules/UseCompatibleCmdlets.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ private bool GetVersionInfoFromPlatformString(
395395
psedition = null;
396396
psversion = null;
397397
os = null;
398-
const string pattern = @"^(?<psedition>core|desktop)-(?<psversion>[\S]+)-(?<os>windows|linux|osx)$";
398+
const string pattern = @"^(?<psedition>core|desktop)-(?<psversion>[\S]+)-(?<os>windows|linux|macos)$";
399399
var match = Regex.Match(fileName, pattern, RegexOptions.IgnoreCase);
400400
if (match == Match.Empty)
401401
{

0 commit comments

Comments
 (0)