PowerShell / PowerShell/PSScriptAnalyzer
Formatting the PowerShell script removes necessary pipe operator `|`
オープン
まだ誰も着手していません。
Area - Formatter
Issue - Bug
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
System Details
System Details Output
### VSCode version: 1.51.1 e5a624b788d92b8d34d1392e4c4d9789406efe8f x64
### VSCode extensions:
janisdd.vscode-edit-csv@0.6.0
ms-python.python@2021.2.633441544
ms-toolsai.jupyter@2021.2.576440691
ms-vscode.cpptools@1.1.3
ms-vscode.hexeditor@1.3.0
ms-vscode.powershell@2020.6.0
redhat.vscode-commons@0.0.6
redhat.vscode-xml@0.16.1
### PSES version: 2.2.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Description
Create a PowerShell file, input following script, and hit Alt+Shift+F. The pipe operator in $a | ForEach-Object { $_ } is removed.
$a=@('a','b','c')
$b=@{
a=1
b=2
c=3
}
$b | Select-Object -Property ($a | ForEach-Object { $_ })
Related settings in settings.json:
"powershell.codeFormatting.trimWhitespaceAroundPipe": true,
"powershell.codeFormatting.useCorrectCasing": true,
"powershell.codeFormatting.whitespaceBetweenParameters": true,
Expected Behaviour
The format result should look like:
$a = @('a', 'b', 'c')
$b = @{
a = 1
b = 2
c = 3
}
$b | Select-Object -Property ($a | ForEach-Object { $_ })
Actual Behaviour
The format result is (note that the | is missing):
$a = @('a', 'b', 'c')
$b = @{
a = 1
b = 2
c = 3
}
$b | Select-Object -Property ($a ForEach-Object { $_ })
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue に示されている PowerShell スクリプトと formatting settings を使って formatter の問題を再現し、ネストされた pipe 式を処理する PowerShell の formatting エントリーポイントを追跡します。フォーマット済みの出力で内側の | が保持され、この例をカバーする regression test が追加されれば完了です。Issue にはソースファイルも既存のテストも記載されていません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- powershell
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100