PowerShell / PowerShell/PSScriptAnalyzer
Index out of range Error for ScriptDefinition '$a=1' on pwsh 6.1.0.-preview.1 only
Aberta
Ninguém assumiu esta issue ainda.
Area - Rules
Issue - Bug
- Linguagem predominante
- C#
- Estrelas
- 2.2k
- Forks
- 414
- Merge médio
- 13h 1min
- PRs com merge (30d)
- 2
Descrição
Steps to reproduce
Invoke-scriptanalyzer -script '$a=1'
Expected behavior
Triggers PSUseDeclaredVarsMoreThanAssignments rule.
Actual behavior
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
out-lineoutput : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
+ CategoryInfo : NotSpecified: (:) [out-lineoutput], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : System.ArgumentOutOfRangeException,Microsoft.PowerShell.Commands.OutLineOutputCommand
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0-preview.1
PSEdition Core
GitCommitId v6.1.0-preview.1
OS Linux 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018
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.16.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 comando relatado, Invoke-ScriptAnalyzer -Script '$a=1', com PowerShell 6.1.0-preview.1 e PSScriptAnalyzer 1.16.1. Rastreie o tratamento de ScriptDefinition e o caminho de saída que produz o erro de índice; considera-se concluído quando o comando termina e relata PSUseDeclaredVarsMoreThanAssignments sem uma exceção de índice fora do intervalo.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp, powershell
- Domínio
- tooling
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 48/100