PowerShell / PowerShell/PSScriptAnalyzer

Make custom rule name consistent

Offen
#1,545 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Area - Rules Consider - 2.0
Vorherrschende Sprache
C#
Sterne
2.2k
Forks
414
Ø Merge
13 Std. 1 Min.
Gemergte PRs (30 T.)
2

Beschreibung

Apologies if I am repeating something or if this has been discussed already. This is mostly an re-iteration of https://github.com/PowerShell/PSScriptAnalyzer/issues/1140#issuecomment-488251888

As of now, custom rule names are inconsistent across various places.

  • At first, there are no indication about function name in the ScriptRuleDocumention.md . But PSSA is completely depends on $MyInvocation.InvocationName for rule/violation name
  • I can not really have a customized rule name, it should be the name of the PS function. That gives me a weird naming of rules like Measure-Something. On the other I can ship the violation with whatever name I like which has no value and can break things.
  • While suppressing a custom rule, I will have to provide <ModuleName>\<RuleName>. That would end up something like, FooBar\Measure-Something
    • I really do not like this convention as I do not want the developer to be aware of the module name or the function name.
  • It gets worst further, While filtering a rule, I can not follow the same convention, it has to be the name whatever the function name.
Invoke-ScriptAnalyzer -IncludeRule Measure-Something -ExcludeRule Measure-SomethingElse

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit ScriptRuleDocumentation.md und dem hier beschriebenen Verhalten von Invoke-ScriptAnalyzer IncludeRule/ExcludeRule und der Suppression; prüfe die verknüpfte Issue-Diskussion auf bisherigen Kontext. Erledigt ist die Aufgabe, wenn die Namenskonvention für benutzerdefinierte Regeln festgelegt und konsistent auf Dokumentation, Verletzungsnamen, Suppression und Filterung angewendet wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
powershell
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.