PowerShell / PowerShell/PSScriptAnalyzer
Whitespace Between Parameters Is Trimming Required Quotes
Aberta
Ninguém assumiu esta issue ainda.
Area - Formatter
Issue - Bug
- Linguagem predominante
- C#
- Estrelas
- 2.2k
- Forks
- 415
- Merge médio
- 13h 1min
- PRs com merge (30d)
- 2
Descrição
- ✅ 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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece reproduzindo o problema do formatter com o exemplo de PowerShell na issue, usando as versões listadas do PSScriptAnalyzer. Rastreie a formatação da string It entre aspas e adicione um teste de regressão para o espaço em branco e a aspa necessários. Está concluído quando a formatação preserva a aspa de fechamento e o resultado continua sendo uma sintaxe válida do PowerShell.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- powershell
- Domínio
- tooling
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 45/100