Rule request: `Get-Content x | ConvertFrom-Json` should suggest adding `-raw` for `Get-content`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Không có tệp nguồn hoặc bài kiểm thử nào được nêu tên. Hãy bắt đầu bằng việc xem xét các quy tắc PSScriptAnalyzer hiện có cho Get-Content được pipe vào ConvertFrom-* và issue PowerShell được liên kết; xác định cách xử lý dự kiến đối với các chú thích JSON và trường hợp XML có thể xảy ra. Được coi là hoàn tất khi analyzer nhất quán đề xuất -Raw ở những nơi phù hợp và hành vi này được bao phủ bởi các bài kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary of the new feature
When you call get-content file.json | convertfrom-json, funny things happen when file.json contains a comment at the top of the file.
Multiple places suggest that it's better to use get-content -raw for performance and predictability.
See:
- https://github.com/PowerShell/PowerShell/issues/12229
- https://stackoverflow.com/questions/71025659/set-property-value-on-object-loaded-from-json-containing-comments
Proposed technical implementation details (optional)
When get-content is piped to convertfrom-*, PSScriptAnalyzer should suggest adding -raw to get-content.
The same could apply to [xml] get-content file.xml.
What is the latest version of PSScriptAnalyzer at the point of writing
1.21
- Ngôn ngữ chính
- C#
- Star
- 2.2k
- Fork
- 415
- Merge trung bình
- 13 giờ 1 phút
- Pull request đã merge (30 ngày)
- 2
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.
Issue khác của PowerShell/PSScriptAnalyzer
-
Up-for-Grabs
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
PowerShell/PSScriptAnalyzer#2213 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
PowerShell/PSScriptAnalyzer#2217 · 1 bình luận ·
-
PSUseConsistentIndentation double-indents attribute bodies that open a scriptblock (`[Attr({ … })]`) Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
PowerShell/PSScriptAnalyzer#2216 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
PowerShell/PSScriptAnalyzer#2211 ·
-
`PSPlaceOpenBrace` and `PSPlaceCloseBrace` leave trailing whitespace when expanding one-line blocks Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
PowerShell/PSScriptAnalyzer#2210 ·
Tất cả issue của PowerShell/PSScriptAnalyzer
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nightscout/nocturne#1379 ·
-
release-notes in .NET 11 RC2 Đang mởpriority-0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
StackExchange/StackExchange.Redis#3249 ·
-
[Feat] 조합 영역 구분선 개선 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100