PowerShell / PowerShell/PSScriptAnalyzer

Whitespace Between Parameters Is Trimming Required Quotes

Abierto
#1,561 13 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

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

Descripción

  • ✅ Make sure you are able to repro it on the latest released version
  • ✅ Perform a quick search for existing issues to check if this bug has already been reported.
    • Might be related to #1540

This was one of the more simple examples I could find.
I found this issue popping up in random files and finally realized it was a formatter issue.

Steps to reproduce

Describe "DescribeName" {
    Context "ContextName" {
        It "ItName" {
            Assertion
        }
        It "output: attributes     matches  $($outputs.attributes)" {
            $results.attributes | Should -Be $outputs.attributes
        }
    }
}

Expected behavior

Describe "DescribeName" {
    Context "ContextName" {
        It "ItName" {
            Assertion
        }
        It "output: attributes     matches  $($outputs.attributes)" {
            $results.attributes | Should -Be $outputs.attributes
        }
    }
}

Actual behavior

Describe "DescribeName" {
    Context "ContextName" {
        It "ItName" {
            Assertion
        }
        It "output: attributes     matches  $($outputs.attributes){ <----- it removed valid quote, resulting in breaking syntax
            $results.attributes | Should -Be $outputs.attributes
        }
    }
}

Environment data


> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.19.0
1.18.3
1.19.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

Comienza reproduciendo el problema del formateador con el ejemplo de PowerShell del issue, utilizando las versiones de PSScriptAnalyzer indicadas. Rastrea el formateo de la cadena It entre comillas y añade una prueba de regresión para el espacio en blanco y la comilla requeridos. Se considera terminado cuando el formateo conserva la comilla de cierre y el resultado sigue siendo sintaxis válida de PowerShell.

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
3/5
Tiempo estimado
1-2 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.