Skip to content

Commit

Permalink
Add CommandData files of PowerShell Core 6.0.2 for Windows/Linux/macO…
Browse files Browse the repository at this point in the history
…S 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
  • Loading branch information
bergmeister authored May 17, 2018
1 parent c632ea1 commit f1222ef
Show file tree
Hide file tree
Showing 13 changed files with 18,780 additions and 5,887 deletions.
1,821 changes: 0 additions & 1,821 deletions Engine/Settings/core-6.0.0-alpha-linux.json

This file was deleted.

1,821 changes: 0 additions & 1,821 deletions Engine/Settings/core-6.0.0-alpha-osx.json

This file was deleted.

2,238 changes: 0 additions & 2,238 deletions Engine/Settings/core-6.0.0-alpha-windows.json

This file was deleted.

1,648 changes: 1,648 additions & 0 deletions Engine/Settings/core-6.0.2-linux.json

Large diffs are not rendered by default.

1,648 changes: 1,648 additions & 0 deletions Engine/Settings/core-6.0.2-macos.json

Large diffs are not rendered by default.

2,075 changes: 2,075 additions & 0 deletions Engine/Settings/core-6.0.2-windows.json

Large diffs are not rendered by default.

6,268 changes: 6,268 additions & 0 deletions Engine/Settings/desktop-3.0-windows.json

Large diffs are not rendered by default.

7,133 changes: 7,133 additions & 0 deletions Engine/Settings/desktop-4.0-windows.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions RuleDocumentation/UseCompatibleCmdlets.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

## Description

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:
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:

```PowerShell
@{
'Rules' = @{
'PSUseCompatibleCmdlets' = @{
'compatibility' = @("core-6.0.0-alpha-windows")
'compatibility' = @("core-6.0.2-windows")
}
}
}
```

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}`.
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}`.
2 changes: 1 addition & 1 deletion Rules/UseCompatibleCmdlets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private bool GetVersionInfoFromPlatformString(
psedition = null;
psversion = null;
os = null;
const string pattern = @"^(?<psedition>core|desktop)-(?<psversion>[\S]+)-(?<os>windows|linux|osx)$";
const string pattern = @"^(?<psedition>core|desktop)-(?<psversion>[\S]+)-(?<os>windows|linux|macos)$";
var match = Regex.Match(fileName, pattern, RegexOptions.IgnoreCase);
if (match == Match.Empty)
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Rules/UseCompatibleCmdlets.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Describe "UseCompatibleCmdlets" {
}
}

$settings = @{rules=@{PSUseCompatibleCmdlets=@{compatibility=@("core-6.0.0-alpha-windows")}}}
$settings = @{rules=@{PSUseCompatibleCmdlets=@{compatibility=@("core-6.0.2-windows")}}}

Context "Microsoft.PowerShell.Core" {
@('Enter-PSSession', 'Foreach-Object', 'Get-Command') | `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@{
'Rules' = @{
'PSUseCompatibleCmdlets' = @{
'compatibility' = @("core-6.0.0-alpha-windows")
'compatibility' = @("core-6.0.2-windows")
}
}
}
2 changes: 1 addition & 1 deletion Utils/New-CommandDataFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.EXAMPLE
C:\PS> ./New-CommandDataFile.ps1
Suppose this file is run on the following version of PowerShell: PSVersion = 6.0.0-aplha, PSEdition = Core, and Windows 10 operating system. Then this script will create a file named core-6.0.0-alpha-windows.json that contains a JSON object of the following form:
Suppose this file is run on the following version of PowerShell: PSVersion = 6.0.2, PSEdition = Core, and Windows 10 operating system. Then this script will create a file named core-6.0.2-windows.json that contains a JSON object of the following form:
{
"Modules" : [
"Module1" : {
Expand Down

0 comments on commit f1222ef

Please sign in to comment.