PowerShell / PowerShell/PSScriptAnalyzer

PSProvideCommentHelp should also warn on script param blocks

Offen
#1,363 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Area - Formatter Area - Rules Issue - Enhancement Up-for-Grabs
Vorherrschende Sprache
C#
Sterne
2.2k
Forks
414
Ø Merge
13 Std. 1 Min.
Gemergte PRs (30 T.)
2

Beschreibung

Summary of the new feature

As a user, I want the ## comment generation feature in the PowerShell extension for VSCode to also generate comment based help for param blocks at the top of scripts. The PowerShell extension leverages the PSProvideCommentHelp rule to do this.

Proposed technical implementation details (optional)

Invoke-ScriptAnalyzer -ScriptDefinition 'param($foo)' -Settings @{ 
  Rules = @{
      PSProvideCommentHelp = @{
          Enable = $true
          ExportedOnly = $false
          BlockComment = $true
          VSCodeSnippetCorrection = $false
          Placement = "before"
      }
  }
  }

This should yield a diagnostic record just like this does:

Invoke-ScriptAnalyzer -ScriptDefinition 'function asdf { param($foo) }' -Settings @{
  Rules = @{
      PSProvideCommentHelp = @{
          Enable = $true
          ExportedOnly = $false
          BlockComment = $true
          VSCodeSnippetCorrection = $false
          Placement = "before"
      }
  }
  }


RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSProvideCommentHelp                Information             1     The cmdlet 'asdf' does not have a help comment.

What is the latest version of PSScriptAnalyzer at the point of writing

1.18.3

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 der Regel PSProvideCommentHelp und verwende Invoke-ScriptAnalyzer mit der Skriptdefinition param($foo) auf oberster Ebene als Reproduktion. Vergleiche sie mit dem vorhandenen Beispiel für function param; abgeschlossen ist die Aufgabe, wenn der Skript-Parameterblock dieselbe Help-Comment-Diagnose erzeugt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
powershell
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

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