PowerShell / PowerShell/PSScriptAnalyzer

PSProvideCommentHelp should also warn on script param blocks

Đang mở
#1,363 2 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 - Formatter Area - Rules Issue - Enhancement 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ả

Summary of the new feature

As a user, I want the ## comment generation feature in the PowerShell extension for VSCode to also generate comment based help for param blocks at the top of scripts. The PowerShell extension leverages the PSProvideCommentHelp rule to do this.

Proposed technical implementation details (optional)

Invoke-ScriptAnalyzer -ScriptDefinition 'param($foo)' -Settings @{ 
  Rules = @{
      PSProvideCommentHelp = @{
          Enable = $true
          ExportedOnly = $false
          BlockComment = $true
          VSCodeSnippetCorrection = $false
          Placement = "before"
      }
  }
  }

This should yield a diagnostic record just like this does:

Invoke-ScriptAnalyzer -ScriptDefinition 'function asdf { param($foo) }' -Settings @{
  Rules = @{
      PSProvideCommentHelp = @{
          Enable = $true
          ExportedOnly = $false
          BlockComment = $true
          VSCodeSnippetCorrection = $false
          Placement = "before"
      }
  }
  }


RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSProvideCommentHelp                Information             1     The cmdlet 'asdf' does not have a help comment.

What is the latest version of PSScriptAnalyzer at the point of writing

1.18.3

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 rule PSProvideCommentHelp và sử dụng Invoke-ScriptAnalyzer với định nghĩa script param($foo) ở cấp cao nhất làm trường hợp tái hiện. So sánh với ví dụ function param hiện có; hoàn tất khi khối tham số của script tạo ra cùng một chẩn đoán về chú thích trợ giúp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
powershell
Lĩnh vực
tooling
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
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
48/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.