PowerShell / PowerShell/PSScriptAnalyzer
Formatting Issue, example included
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
Issue Type: Bug
This is an example of the formatting issue I have been struggling with. It appears that that using a multi-line piping statement, along with the 'Out-Null' is the cause in this situation. Formatting the document adds an additional tab each time this code happens. I have much more involved code then this example that becomes really confusing when this indent issue occurs.
function Test-Format([int]$num) {
if($num -eq 1){
Get-ChildItem -Path 'c:\*.*' | Where-Object {$_.name -like 'test1.*'} |
ForEach-Object{Remove-Item -Path $_ | Out-Null}
}
else{
Get-ChildItem -Path 'c:\*.*' | Where-Object {$_.name -like 'test2.*'} |
ForEach-Object{Remove-Item -Path $_ | Out-Null}
}
}
Test-format -num 1
Extension version: 2021.2.2
VS Code version: Code 1.54.1 (f30a9b73e8ffc278e71575118b6bf568f04587c8, 2021-03-04T22:38:31.419Z)
OS version: Windows_NT x64 10.0.19042
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz (8 x 3700) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: unavailable_off rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 31.92GB (22.25GB free) |
| Process Argv | --crash-reporter-id 73837bc4-9684-4f62-8d48-bb5a4bc03bd8 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstry244cf:30256637
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt875:30259475
dockersubset:30265998
pythontbcf:30265426
vspre833:30267464
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、このレポートにある複数行の PowerShell パイプラインと Out-Null の例で問題を再現します。可能であれば、記載されているバージョンの PSScriptAnalyzer 拡張機能と VS Code を使用してください。パイプラインのインデントを処理するフォーマッターのエントリーポイントを追跡します。繰り返しフォーマットしても余分なタブが追加されず、示されている if/else 構造が正しく整列されたままになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- powershell
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100