PowerShell / PowerShell/PSScriptAnalyzer
Index out of range Error for ScriptDefinition '$a=1' on pwsh 6.1.0.-preview.1 only
未关闭
还没有人认领这个 Issue。
Area - Rules
Issue - Bug
- 主要语言
- C#
- 星标
- 2.2k
- 派生
- 414
- 平均合并
- 13 小时 1 分钟
- 30 天内合并 PR
- 2
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 PowerShell 6.1.0-preview.1 和 PSScriptAnalyzer 1.16.1 重现报告的命令 Invoke-ScriptAnalyzer -Script '$a=1'。跟踪 ScriptDefinition 的处理以及产生索引错误的输出路径;完成标准是命令执行完成,并报告 PSUseDeclaredVarsMoreThanAssignments,且不出现越界异常。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, powershell
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100