Skip to content

PSUseCompatibleCmdlets flagging compatible items as incompatible #639

@RamblingCookieMonster

Description

@RamblingCookieMonster

Hi!

tldr:

  • PSUseCompatibleCmdlets is flagging known-good cmdlets as incompatible. For example, Where-Object is flagged.
  • PSUseCompatibleCmdlets is flagging aliases as incompatible, e.g. Select
  • PSUseCompatibleCmdlets is flagging custom defined commands from the module itself (might be good to do this, but, just an FYI)

Output:

PSUseCompatibleCmdlets               Warning  PSDeploy.psm1 8    'Where-Object' is not compatible with PowerShell edition 'core', version '6.0.0-alpha' and OS 'windows'                
PSUseCompatibleCmdlets               Warning  PSDeploy.psm1 9    'Select' is not compatible with PowerShell edition 'core', version '6.0.0-alpha' and OS 'windows'                      
PSUseCompatibleCmdlets               Warning  PSDeploy.psm1 29   'Import-Module' is not compatible with PowerShell edition 'core', version '6.0.0-alpha' and OS 'windows'

Environment:

PS C:\> $PSVersionTable

Name                           Value                                                                                                   
----                           -----                                                                                                   
PSVersion                      5.0.10586.117                                                                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                 
BuildVersion                   10.0.10586.117                                                                                          
CLRVersion                     4.0.30319.42000                                                                                         
WSManStackVersion              3.0                                                                                                     
PSRemotingProtocolVersion      2.3                                                                                                     
SerializationVersion           1.1.0.1   
PS C:\> Get-Module PSScriptAnalyzer | Select Version

Version
-------
1.8.0  

Settings file:

    'Rules' = @{
        'PSUseCompatibleCmdlets' = @{
            'compatibility' = @("core-6.0.0-alpha-windows", "core-6.0.0-alpha-linux", "core-6.0.0-alpha-osx")
        }
    }
}

Also tried with without listing all three (e.g. just core-6.0.0-alpha-windows)

Cheers!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions