PowerShell / PowerShell/PSScriptAnalyzer

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

Abierto
#1,120 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Area - Formatter
Lenguaje dominante
C#
Estrellas
2.2k
Forks
414
Merge medio
13 h 1 min
PR fusionados (30 d)
2

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza reproduciendo el ejemplo de tabla hash proporcionado con Invoke-Formatter en PSScriptAnalyzer 1.17.1 y, después, compáralo con la versión en la que PivotRows se mueve a la línea siguiente. Rastrea el comportamiento del formateador para la entrada de la tabla hash de la primera línea. Se considera terminado cuando el archivo completo se formatea correctamente sin colapsar el contenido de la tabla hash.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
powershell
Área
tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.