Improve Usability of PSScriptAnalyzer.psd1

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

Dieses Issue hat noch niemand übernommen.

Bewertung

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

Rechercherichtung

Beginne mit PSScriptAnalyzer.psd1 und der in der Issue verlinkten Dokumentation zu AvoidUsingCmdletAliases. Reproduziere den Fehler, indem du das Rules-Mitglied hinzufügst und Import-Module PSScriptAnalyzer ausführst. Fertig ist die Aufgabe, wenn die dokumentierte Regelkonfiguration ohne den Fehler manifest-invalid-members verwendet werden kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Summary of the new feature
According to the docs it's as simple as adding rules to the Rules HashMap in PSScriptAnalyzer.psd1:

PSScriptAnalyzer.psd1
@{

  Rules             = @{
    'PSAvoidUsingCmdletAliases' = @{
      'allowlist' = @('cd', 'cls', 'copy', 'cp'')
    }
  }

  # Author of this module
  Author            = 'Microsoft Corporation'
...

Followed by running:

Import-Module PSScriptAnalyzer

However, in practice this does not work at all:

Import-Module: The '...\ms-vscode.powershell-2025.0.0\modules\PSScriptAnalyzer\1.23.0\PSScriptAnalyzer.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport', 'DscResourcesToExport', 'CompatiblePSEditions', 'HelpInfoURI', 'RootModule', 'DefaultCommandPrefix').
Remove the members that are not valid ('Rules'), then try to import the module again.

I am sure this is just a beginners mistake and CAN work but it SHOULD JUST work.

Proposed technical implementation details (optional)

A clear and concise description of what you want to happen.

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

Vorherrschende Sprache
C#
Sterne
2.2k
Forks
415
Ø Merge
13 Std. 1 Min.
Gemergte PRs (30 T.)
2

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus PowerShell/PSScriptAnalyzer

Alle Issues in PowerShell/PSScriptAnalyzer

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

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