PowerShell / PowerShell/vscode-powershell

Have PowerShell formatter remove trailing whitespace when formatting a file

Aperta
#5,111 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-Code Formatting Area-Script Analysis Issue-Enhancement
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 issues to ensure it has not already been reported.
Summary

When allowing the PSScriptAnalyzerSettings.psd1 to show Information-level problems, it adds a lot of overhead in formatting files that have lines with trailing whitespaces. Since this recommendation is mostly aesthetic/non-breaking, as is the automated code formatting in general, I'd like to see the formatter for PowerShell remove these trailing whitespaces characters.

https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/rules/avoidtrailingwhitespace?view=ps-modules

Because we can't store a centralized configuration for PSScriptAnalyzerSettings.psd1 in source control at the repo/workspace level to have it be taken automatically be any user working on that repo, having per-user rules to suppress this aren't really practical. I did see a separate thread in this project's issues noting individual users can set a configuration flag to do this, but again, having every user do that themselves vs. having a central linting rule is frustrating to maintain adherence on. Short of having a CI/CD pipeline hard reject any PSScriptAnalyzer errors to force them to check in cleaned code, an automated approach is best.

image
Proposed Design

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

L’issue non indica alcun file sorgente né alcun test. Inizia individuando l’implementazione del formatter PowerShell in questa estensione VS Code TypeScript e riproduci la formattazione su un file con spazi bianchi finali. Il lavoro è completato quando l’output formattato rimuove gli spazi bianchi finali senza modificare contenuti non correlati, con la relativa copertura nei test di formattazione, se esistono.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.