PowerShell / PowerShell/PSScriptAnalyzer
Lines unaffected from sytax errors get formatted wrong on PowerShell 5
Chưa có ai nhận issue này.
- 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ả
Before submitting a bug report:
- 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
Steps to reproduce
- Open a PowerShell 5 window
- Type the following code with intentional syntax errors:
$code = @"
@(
@{
""
}
""
)
test /parameter
"@
Invoke-Formatter $code
Expected behavior
Slash should not be seperated from parameter since it isn't affected from the syntax error.
@(
@{
""
}
""
)
test /parameter
Actual behavior
Slash is treated as an operator and is seperated from parameter. This behavior is unique to PowerShell 5 and does not occur in v7.
@(
@{
""
}
""
)
test / parameter
If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.1320
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1320
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.20.0
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 trường hợp PowerShell 5 với Invoke-Formatter và đoạn snippet lỗi cú pháp được cung cấp, sau đó lần theo đường đi của formatter xử lý các dòng không bị ảnh hưởng sau lỗi parse. Hoàn thành khi PowerShell 5 vẫn giữ dấu gạch chéo gắn với parameter, khớp với output mong đợi, mà không thay đổi hành vi hiện có của PowerShell 7.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- 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
- 35/100