PowerShell / PowerShell/PSScriptAnalyzer
Improve Usability of PSScriptAnalyzer.psd1
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C#
- Star
- 2.2k
- Fork
- 414
- Merge trung bình
- 13 giờ 1 phút
- Pull request đã merge (30 ngày)
- 2
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với PSScriptAnalyzer.psd1 và tài liệu AvoidUsingCmdletAliases được liên kết trong issue. Tái hiện lỗi bằng cách thêm member Rules và chạy Import-Module PSScriptAnalyzer. Hoàn tất khi cấu hình rule được mô tả trong tài liệu có thể được sử dụng mà không gặp lỗi manifest-invalid-members.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- powershell
- Lĩnh vực
- tooling
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100