PowerShell / PowerShell/PSScriptAnalyzer
Improve Usability of PSScriptAnalyzer.psd1
還沒有人認領這個 Issue。
- 主要語言
- C#
- 星號
- 2.2k
- 分支
- 414
- 平均合併
- 13 小時 1 分鐘
- 30 天內合併 PR
- 2
描述
Summary of the new feature
According to the docs it's as simple as adding rules to the Rules HashMap in PSScriptAnalyzer.psd1:
PSScriptAnalyzer.psd1
@{
Rules = @{
'PSAvoidUsingCmdletAliases' = @{
'allowlist' = @('cd', 'cls', 'copy', 'cp'')
}
}
# Author of this module
Author = 'Microsoft Corporation'
...
Followed by running:
Import-Module PSScriptAnalyzer
However, in practice this does not work at all:
Import-Module: The '...\ms-vscode.powershell-2025.0.0\modules\PSScriptAnalyzer\1.23.0\PSScriptAnalyzer.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport', 'DscResourcesToExport', 'CompatiblePSEditions', 'HelpInfoURI', 'RootModule', 'DefaultCommandPrefix').
Remove the members that are not valid ('Rules'), then try to import the module again.
I am sure this is just a beginners mistake and CAN work but it SHOULD JUST work.
Proposed technical implementation details (optional)
A clear and concise description of what you want to happen.
What is the latest version of PSScriptAnalyzer at the point of writing
1.24.0
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 PSScriptAnalyzer.psd1 和 issue 中連結的 AvoidUsingCmdletAliases 文件開始。新增 Rules 成員並執行 Import-Module PSScriptAnalyzer 以重現失敗。當文件中的規則設定可以在不出現 manifest-invalid-members 錯誤的情況下使用時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- powershell
- 領域
- tooling
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100