You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some users have had problems starting PSES because other modules override core cmdlets (in the above case, Set-Content is redefined...). We can't prevent it, but ideally module authors should get a stern warning!
In user story terms:
As a module/script author, I want to be warned when I'm redefining core cmdlets
so that my module/script is less likely to interfere with/break other PowerShell modules when installed.
Proposed technical implementation details
The rule should probably lazily cache all the cmdlet names in the following core modules:
Microsoft.PowerShell.Core
Microsoft.PowerShell.Management
Microsoft.PowerShell.Utility
PSReadLine
Microsoft.PowerShell.Diagnostics
Microsoft.PowerShell.Host
Microsoft.PowerShell.Security
Microsoft.PowerShell.Archive
Microsoft.WSMan.Management
PowerShellGet?
An ideal implementation probably has a default list of modules, which can be changed or added to.
The simplest way to do this is to read the module manifest or run Get-Module <module> | Select-Object ExportedCommands.
In the case where an author wants to prevent redefining cmdlets in a module they don't have installed at analysis time, I'm not entirely sure what the correct solution is, but can't imagine the problem being insoluble.
What is the latest version of PSScriptAnalyzer at the point of writing
1.17.1
The text was updated successfully, but these errors were encountered:
Summary of the new feature
Followup from PowerShell/PowerShellEditorServices#686 (review).
Some users have had problems starting PSES because other modules override core cmdlets (in the above case,
Set-Content
is redefined...). We can't prevent it, but ideally module authors should get a stern warning!In user story terms:
Proposed technical implementation details
The rule should probably lazily cache all the cmdlet names in the following core modules:
Microsoft.PowerShell.Core
Microsoft.PowerShell.Management
Microsoft.PowerShell.Utility
PSReadLine
Microsoft.PowerShell.Diagnostics
Microsoft.PowerShell.Host
Microsoft.PowerShell.Security
Microsoft.PowerShell.Archive
Microsoft.WSMan.Management
PowerShellGet
?An ideal implementation probably has a default list of modules, which can be changed or added to.
The simplest way to do this is to read the module manifest or run
Get-Module <module> | Select-Object ExportedCommands
.In the case where an author wants to prevent redefining cmdlets in a module they don't have installed at analysis time, I'm not entirely sure what the correct solution is, but can't imagine the problem being insoluble.
What is the latest version of PSScriptAnalyzer at the point of writing
1.17.1
The text was updated successfully, but these errors were encountered: