PowerShell / PowerShell/PSScriptAnalyzer

New Rule Suggestion: PSAvoidShorteningParameterNames

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

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

Area - Rules Up-for-Grabs
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ả

As long as we're trying to get people to stop using aliases and positional parameters and shortened command names, we should fix the parameters too.

Summary of the new feature

A new rule that complains when you write Get-Content -Pa file.txt -ov contents and offers suggestions with the full proper parameter name of each parameter: Get-Content -Path file.txt -OutVariable contents

It should complain about shortened parameters and parameter aliases, when you're passing them directly -- but shouldn't worry about splatting or pipeline properties, etc.

Bonus points if you make it a ConfigurableRule with a setting to ignore parameter names that match aliases (as opposed to just being shortened forms of parameters or parameter aliases).

Double bonus points if you make AvoidPositionalParameters also a ConfigurableRule so people can choose to fail even if only one positional parameter is passed.

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

Không có tệp hoặc bài kiểm thử nào được nêu tên. Hãy bắt đầu bằng cách tìm rule AvoidPositionalParameters hiện có và pattern ConfigurableRule trong PSScriptAnalyzer, sau đó theo dõi cách các rule kiểm tra tham số lệnh. Công việc được xem là hoàn tất khi rule mới xử lý các tên rút gọn và alias, đồng thời loại trừ splatting và các thuộc tính pipeline; cấu hình tùy chọn và các thay đổi đối với AvoidPositionalParameters được hỗ trợ riêng nếu được triển khai.

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
cli, 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
25/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.