Skip to content

Commit 7e13d76

Browse files
author
Kapil Borle
committed
Add UseCompatibleCmdlets rule documentation
1 parent bf20113 commit 7e13d76

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

RuleDocumentation/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@
4545
|[UseShouldProcessForStateChangingFunctions](./UseShouldProcessForStateChangingFunctions.md) | Warning|
4646
|[UseSingularNouns](./UseSingularNouns.md) | Warning|
4747
|[UseStandardDSCFunctionsInResource](./UseStandardDSCFunctionsInResource.md) | Error |
48-
|[UseToExportFieldsInManifest](./UseToExportFieldsInManifest.md) | Warning|
48+
|[UseToExportFieldsInManifest](./UseToExportFieldsInManifest.md) | Warning|
49+
|[UseCompatibleCmdlets](./UseCompatibleCmdlets.md) | Warning|

RuleDocumentation/UseCompatibleCmdlets.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
**Severity Level: Warning**
33

44
## Description
5-
6-
## How to Fix
7-
8-
## Example
9-
### Wrong:
5+
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:
106
```PowerShell
11-
7+
@{
8+
'Rules' = @{
9+
'PSUseCompatibleCmdlets' = @{
10+
'compatibility' = @("core-6.0.0-alpha-windows")
11+
}
12+
}
13+
}
1214
```
1315

14-
### Correct:
15-
```PowerShell
16-
17-
```
16+
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}`.

0 commit comments

Comments
 (0)