Skip to content

Commit dff9522

Browse files
authored
Add Command data files of PowerShell 6.1.0 (#1075)
* add command data file for pwsh 6.1.0 on windows 10 1803. Also make it the default reference * add command date file using Ubuntu 18.04 * update documentation * add os details about command data files * Add macOS file from SteveL-MSFT and add to documentation * Add command data file for raspbian and add to docs. Thanks @tylerl0706 * Remove 6.0.2 files since we have 6.1 files and 6.0 is out of support already * fix failing test by adapting settings file and add more info to documentation
1 parent d1a12b6 commit dff9522

9 files changed

+1994
-143
lines changed

Engine/Settings/core-6.0.2-linux.json renamed to Engine/Settings/core-6.1.0-linux-arm.json

+90-42
Large diffs are not rendered by default.

Engine/Settings/core-6.0.2-macos.json renamed to Engine/Settings/core-6.1.0-linux.json

+92-44
Large diffs are not rendered by default.

Engine/Settings/core-6.1.0-macos.json

+1,696
Large diffs are not rendered by default.

Engine/Settings/core-6.0.2-windows.json renamed to Engine/Settings/core-6.1.0-windows.json

+99-51
Large diffs are not rendered by default.

RuleDocumentation/UseCompatibleCmdlets.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@ This rule flags cmdlets that are not available in a given Edition/Version of Pow
1010
@{
1111
'Rules' = @{
1212
'PSUseCompatibleCmdlets' = @{
13-
'compatibility' = @("core-6.0.2-windows")
13+
'compatibility' = @("core-6.1.0-windows")
1414
}
1515
}
1616
}
1717
```
1818

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}`.
19+
The parameter `compatibility` is a list that contain any of the following
20+
21+
- desktop-3.0-windows
22+
- desktop-4.0-windows (taken from Windows Server 2012R2)
23+
- desktop-5.1.14393.206-windows
24+
- core-6.1.0-windows (taken from Windows 10 - 1803)
25+
- core-6.1.0-linux (taken from Ubuntu 18.04)
26+
- core-6.1.0-linux-arm (taken from Raspbian)
27+
- core-6.1.0-macos
28+
29+
Usually, patched versions of PowerShell have the same cmdlet data, therefore only settings of major and minor versions of PowerShell are supplied. One can also create a custom settings file as well with the [New-CommandDataFile.ps1](https://github.com/PowerShell/PSScriptAnalyzer/blob/development/Utils/New-CommandDataFile.ps1) script and use it by placing the created `JSON` into the `Settings` folder of the `PSScriptAnalyzer` module installation folder, then the `compatibility` parameter is just its file name (that can also be changed if desired).
30+
Note that the `core-6.0.2-*` files were removed in PSScriptAnalyzer 1.18 since PowerShell 6.0 reached it's end of life.

Rules/UseCompatibleCmdlets.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private struct RuleParameters
4646
private bool hasInitializationError;
4747
private string reference;
4848
private readonly string defaultReference = "desktop-5.1.14393.206-windows";
49-
private readonly string alternativeDefaultReference = "core-6.0.2-windows";
49+
private readonly string alternativeDefaultReference = "core-6.1.0-windows";
5050
private RuleParameters ruleParameters;
5151

5252
public UseCompatibleCmdlets()

Tests/Rules/UseCompatibleCmdlets.tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Describe "UseCompatibleCmdlets" {
3535
}
3636
}
3737

38-
$settings = @{rules=@{PSUseCompatibleCmdlets=@{compatibility=@("core-6.0.2-windows")}}}
38+
$settings = @{rules=@{PSUseCompatibleCmdlets=@{compatibility=@("core-6.1.0-windows")}}}
3939

4040
Context "Microsoft.PowerShell.Core" {
4141
@('Enter-PSSession', 'Foreach-Object', 'Get-Command') | `
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
'Rules' = @{
33
'PSUseCompatibleCmdlets' = @{
4-
'compatibility' = @("core-6.0.2-windows")
4+
'compatibility' = @("core-6.1.0-windows")
55
}
66
}
77
}

Utils/New-CommandDataFile.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.EXAMPLE
66
C:\PS> ./New-CommandDataFile.ps1
77
8-
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:
8+
Suppose this file is run on the following version of PowerShell: PSVersion = 6.1.0, PSEdition = Core, and Windows 10 operating system. Then this script will create a file named core-6.1.0-windows.json that contains a JSON object of the following form:
99
{
1010
"Modules" : [
1111
"Module1" : {

0 commit comments

Comments
 (0)