PowerShell / PowerShell/PSScriptAnalyzer

PSShouldProcess Rule and module specific adaption

Aperta
#1,078 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area - Configuration Issue - Enhancement
Lingua principale
C#
Stelle
2.2k
Fork
414
Merge medio
13h 1m
PR unite (30g)
2

Descrizione

Scenario

One of the default rules checks, whether a command that supports should process, actually uses ...

$PSCmdlet.ShouldProcess( ... )

Now, this is a great rule in principle, but in the framework module I maintain (https://psframework.org) I've got a cmdlet that replaces that method call (for readability and mocking reasons).

My current solution is to disable the specific script analyzer rule (PSShouldProcess) in my automatic tests. Which works well enough for my purposes.
But it would be more awesome if it were to detect the command and equate it with the method call (cause I'd actually appreciate having that check enabled, if it were practical).

Creating my own rule wouldn't be a problem, so my own projects would be covered. But since I'm trying to distribute this to others - with increasing success - distributing the custom rule to their tests would be ... inconvenient outside of PSScriptAnalyzer.

Questions

What's the policy on changes to rules that are module specific?

If I write that update, would it even be considered?

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 con la regola PSShouldProcess e i test automatici descritti nell’issue; non è indicato alcun file sorgente né alcun percorso dei test. Il lavoro sarebbe completato con una policy concreta per gli equivalenti dei comandi specifici del modulo e un ambito di implementazione concordato, seguiti da test che dimostrino che la regola gestisce l’adattamento proposto.

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

Valutazione

Stack tecnologico
csharp, powershell
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.