PowerShell / PowerShell/PSScriptAnalyzer

Invoke-Formatter: Adding whitespace after opening parenthesis

Đang mở
#1,288 1 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 Issue - Bug
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ả

Not sure if a parameter to control this behavior. I looked but couldn't find any, correct me if I'm wrong.

Steps to reproduce

Invoke-Formatter -ScriptDefinition '$object.Where({ $_.Property -eq $Value })' -Verbose

Expected behavior

Default I would expect it not to add any space after parenthesis.

$object.Where({ $_.Property -eq $Value })

Or if default should be to add a space after the open parenthesis, I would expect it to also add one before the closing parenthesis by default too. 🙂

$object.Where( { $_.Property -eq $Value } )

Actual behavior

Adds one space after the opening parenthesis.

$object.Where( { $_.Property -eq $Value })

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.18890.1000
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18890.1000
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }

1.18.1

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 bằng cách tái hiện ví dụ Invoke-Formatter với ScriptDefinition được cung cấp và so sánh đầu ra thực tế với cả hai dạng dự kiến. Truy vết điểm vào của formatter để tìm nơi quyết định khoảng cách xung quanh dấu ngoặc đơn, sau đó thêm hoặc cập nhật coverage để xác minh hành vi mặc định đã chọn.

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
Lỗi
Độ 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
35/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.