Default completer for `SuppressMessageAttribute` sets invalid parameter value for `checkId`

Đang mở
#4,659 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
powershell, typescript, vscode

Hướng nghiên cứu

Bắt đầu bằng cách tìm định nghĩa tự động hoàn thành của SuppressMessageAttribute trong tiện ích mở rộng PowerShell của VS Code và tái hiện phần hoàn thành được mô tả trong issue. Theo dõi đối số checkId được tạo ra và cập nhật phần hoàn thành để việc suppression hoạt động với giá trị chuỗi rỗng thay vì $null. Sau đó, xác minh rằng cảnh báo PSSUseShouldProcessForStateChangingFunctions đã tái hiện được suppression.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Issue-Bug Up for Grabs
Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

When adding a SuppressMessageRule using the autosuggest functionality it sets the checkId parameter to $null rather than '' which does not correctly suppress the PSSA rule.

image

PowerShell Version
┏[MichaelO'Toole][dev]
┖[R:\Development\NinjaGet]> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.5
PSEdition                      Core
GitCommitId                    7.3.5
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Visual Studio Code Version
┏[MichaelO'Toole][dev]
┖[R:\Development\NinjaGet]> code --version
1.79.2
695af097c7bd098fbf017ce3ac85e09bbc5dda06
x64
Extension Version
┏[MichaelO'Toole][dev]
┖[R:\Development\NinjaGet]> code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2023.6.0
Steps to Reproduce

Create a blank PS function with a verb that can change system state with the PSSUseShouldProcessForStateChangingFunctions rule enabled - add the suppress rule from the auto complete - note that the warning remains.

Alter the second parameter to '' instead of $null and notice suppression works.

Visuals

No response

Logs

No response

Ngôn ngữ chính
TypeScript
Star
1.9k
Fork
548
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PowerShell/vscode-powershell

Tất cả issue của PowerShell/vscode-powershell

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.