PowerShell / PowerShell/PSScriptAnalyzer
Index out of range Error for ScriptDefinition '$a=1' on pwsh 6.1.0.-preview.1 only
Đang mở
Chưa có ai nhận issue này.
Area - Rules
Issue - Bug
- Ngôn ngữ chính
- C#
- Star
- 2.2k
- Fork
- 414
- Merge trung bình
- 13 giờ 1 phút
- Pull request đã merge (30 ngày)
- 2
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lệnh được báo cáo, Invoke-ScriptAnalyzer -Script '$a=1', với PowerShell 6.1.0-preview.1 và PSScriptAnalyzer 1.16.1. Theo dõi việc xử lý ScriptDefinition và đường dẫn đầu ra tạo ra lỗi chỉ mục; được coi là hoàn tất khi lệnh hoàn thành và báo cáo PSUseDeclaredVarsMoreThanAssignments mà không có ngoại lệ vượt quá phạm vi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp, powershell
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100