PowerShell / PowerShell/PSScriptAnalyzer

PSShouldProcess Rule and module specific adaption

Đang mở
#1,078 4 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 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ả

Scenario

One of the default rules checks, whether a command that supports should process, actually uses ...

$PSCmdlet.ShouldProcess( ... )

Now, this is a great rule in principle, but in the framework module I maintain (https://psframework.org) I've got a cmdlet that replaces that method call (for readability and mocking reasons).

My current solution is to disable the specific script analyzer rule (PSShouldProcess) in my automatic tests. Which works well enough for my purposes.
But it would be more awesome if it were to detect the command and equate it with the method call (cause I'd actually appreciate having that check enabled, if it were practical).

Creating my own rule wouldn't be a problem, so my own projects would be covered. But since I'm trying to distribute this to others - with increasing success - distributing the custom rule to their tests would be ... inconvenient outside of PSScriptAnalyzer.

Questions

What's the policy on changes to rules that are module specific?

If I write that update, would it even be considered?

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 quy tắc PSShouldProcess và các bài kiểm thử tự động được mô tả trong issue; không có tệp mã nguồn hoặc đường dẫn kiểm thử nào được nêu. Để hoàn thành, cần có một chính sách cụ thể cho các lệnh tương đương dành riêng cho mô-đun và một phạm vi triển khai được thống nhất, sau đó là các bài kiểm thử cho thấy quy tắc xử lý được phần điều chỉnh được đề xuất.

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
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
Cần làm rõ
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.