PowerShell / PowerShell/PSScriptAnalyzer

Revise semantics of compatibility rule profile inclusion

Đang mở
#1,224 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Area - Configuration Area - Engine Consider - 2.0 Issue - Enhancement
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ả

UseCompatibleCommands and UseCompatibleTypes create a "union" profile for comparison of target profiles to a base standard. This allows us to use simple heuristic to determine whether a PowerShell AST represents something that is platform-specific (we see if the command or type is available in any platform, and if not ignore it as user-defined).

The problem here is that to create good warnings we have to have a good baseline union profile. Meaning we need to be judicious about how we make the profile. But since we could get it wrong, I created an informal mechanism for including things into the union profile. We use all the profiles in the "profile directory" and nothing else:

https://github.com/PowerShell/PSScriptAnalyzer/blob/df566b577803375cd6f1faba7d9d5d8715deefab/PSCompatibilityAnalyzer/Microsoft.PowerShell.CrossCompatibility/Utility/CompatibilityProfileLoader.cs#L76

This means that:

  • Including only one target, you still get good warnings, because it's compared against all the other profiles we ship by default
  • Using a target not in the profile directory, that won't be included in the union comparison
  • You can configure a different profile directory to get rid of comparisons to PowerShells you don't care about

This works but it's a bit subtle. I think we should move to:

  • All targets are in the union by default
  • Targets in the profile directory are in the union by default
  • Targets can be excluded from the union in a configuration setting, by name or path
  • The profile directory automatic union inclusion can be turned off by default

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với CompatibilityProfileLoader.cs, đặc biệt là logic tải thư mục profile được liên kết trong issue, và theo dõi cách UseCompatibleCommands và UseCompatibleTypes xây dựng profile hợp nhất. Xác định hành vi cấu hình và loại trừ đối với các target được đặt tên hoặc dựa trên đường dẫn, cũng như đối với việc tắt tự động đưa thư mục profile vào. Hoàn tất khi mọi target đều được đưa vào theo mặc định, đồng thời các loại trừ đã cấu hình và thiết lập opt-out được tuân thủ.

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
devtools, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.