PowerShell / PowerShell/vscode-powershell

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

Aperta
#4,659 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Issue-Bug Up for Grabs
Lingua principale
TypeScript
Stelle
1.9k
Fork
548
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando la definizione del completamento automatico di SuppressMessageAttribute nell’estensione PowerShell di VS Code e riproduci il completamento descritto nell’issue. Segui l’argomento checkId generato e aggiorna il completamento in modo che la soppressione funzioni con il valore stringa vuota anziché con $null. Verifica quindi che l’avviso PSSUseShouldProcessForStateChangingFunctions riprodotto venga soppresso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell, typescript, vscode
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.