PowerShell / PowerShell/PSScriptAnalyzer

Format Document with Hash Table entry on first line stopping all formatting in file

Ouverte
#1,120 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Area - Formatter
Langage dominant
C#
Étoiles
2.2k
Forks
414
Merge moyen
13 h 1 min
PR mergées (30 j)
2

Description

Steps to reproduce

following data in VS Code editor will prevent any formatting of PowerShell code in the file. If I move the PivotRows = 'Date' to the next line proper formatting occurs throughout rest of file.

{
    $pt.SprintEffortCharts=@{  PivotRows         = 'Date'
                NoTotalsInPivot = $true
                PivotDataToColumn = $true
    }
    
    }

Output of Invoke-Formatter

Invoke-Formatter -ScriptDefinition "$(Get-Content $scriptPath)" -Verbose 2> .\invoke-formatter.log
VERBOSE: Using settings file at C:\Program Files\WindowsPowerShell\Modules\PSScriptAnalyzer\1.17.1\Settings\CodeFormatting.psd1.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSPlaceCloseBrace rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSPlaceOpenBrace rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSUseConsistentWhitespace rule.
VERBOSE: Found 2 violations.
VERBOSE: Fixed 1 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSUseConsistentWhitespace rule.
VERBOSE: Found 1 violations.
VERBOSE: Fixed 1 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSUseConsistentIndentation rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
VERBOSE: Analyzing Script Definition.
VERBOSE: Running PSAlignAssignmentStatement rule.
VERBOSE: Found 0 violations.
VERBOSE: Fixed 0 violations.
{ $pt.SprintEffortCharts = @{ PivotRows = 'Date' NoTotalsInPivot = $true PivotDataToColumn = $true } }
invoke-formatter.log

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.820
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.820
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.17.1
1.17.1

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire l’exemple de table de hachage fourni avec Invoke-Formatter sur PSScriptAnalyzer 1.17.1, puis comparez-le avec la version dans laquelle PivotRows est déplacé à la ligne suivante. Suivez le comportement du formateur pour l’entrée de table de hachage de la première ligne. C’est terminé lorsque le fichier complet se formate correctement sans regrouper le contenu de la table de hachage.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
powershell
Domaine
tooling
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.