Rule request: Avoid using the Assignment by Addition Operator (`+=`) to build a string
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
- 38/100
Hướng nghiên cứu
Bắt đầu bằng cách xem xét prototype AvoidPlusEqualsToBuildStrings được liên kết và các tham chiếu của issue về phép cộng chuỗi PowerShell. Sau đó, kiểm tra các mẫu quy tắc và bài kiểm tra hiện có của PSScriptAnalyzer. Công việc được hoàn thành khi một quy tắc xác định việc sử dụng += để xây dựng chuỗi và báo cáo việc đó nhất quán với các quy ước của analyzer trong dự án.
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
Strings are immutable. Each addition to the string actually creates a new string big enough to hold the contents of both the left and right operands, then copies the elements of both operands into the new string. For small strings, this overhead may not matter. For large strings, this can affect performance and memory consumption.
This will create more awareness of the possible performance impact of using the Assignment by Addition Operator (+= ), see also:
- Avoid the increase assignment operator (
+=) for building strings - PowerShell scripting performance considerations / String addition
Proposed technical implementation details (optional)
See (PowerShell based) prototype AvoidPlusEqualsToBuildStrings at: https://github.com/iRon7/PSRules
What is the latest version of PSScriptAnalyzer at the point of writing
1.21.0
- 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ự
-
Status: Waiting triage Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
nanoframework/Home#1857 ·
-
kind/bug kind/regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
unoplatform/uno.toolkit.ui#1646 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nightscout/nocturne#1379 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
elastic/esql-dotnet#47 ·
-
port: add go-steam fork Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100