PowerShell / PowerShell/PSScriptAnalyzer

Indentation inconsistent when using more than 1 line continuation

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

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

Area - Formatter 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ả

Before submitting a bug report:

  • Make sure you are able to repro it on the latest released version
  • Perform a quick search for existing issues to check if this bug has already been reported

Steps to reproduce

Execute the following script & compare the formatted output to the input (as defined by the variable $scriptDefinition)

$scriptDefinition = @'
$all_links = `
    [array](Get-ChildItem -Path ([Environment]::GetFolderPath('StartMenu')) -Recurse -Include '*.lnk') + `
    (Get-ChildItem -Path ([Environment]::GetFolderPath('CommonStartMenu')) -Recurse -Include '*.lnk')
'@

Invoke-Formatter -ScriptDefinition $scriptDefinition

Expected behavior

The output of the call to Invoke-Formatter should be the same as the input.

Actual behavior

The third line of the output is not indented to the same level as the second line - the output of Invoke-Formatter is as shown below.

$all_links = `
    [array](Get-ChildItem -Path ([Environment]::GetFolderPath('StartMenu')) -Recurse -Include '*.lnk') + `
(Get-ChildItem -Path ([Environment]::GetFolderPath('CommonStartMenu')) -Recurse -Include '*.lnk')

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.18356.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18356.1
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.0

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 chạy script PowerShell được cung cấp thông qua Invoke-Formatter với PSScriptAnalyzer 1.18.0 và kiểm tra cách nhiều phần tiếp dòng bằng backtick được thụt lề. Hoàn thành khi dòng thứ ba được thụt lề ở cùng cấp với dòng thứ hai và đầu ra đã định dạng khớp với đầu vào.

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.