Invoke-Formatter is not idempotent on `--%` verbatim arguments
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- powershell
- 領域
- tooling
研究方向
首先,使用帶有 --% stop-parsing token 的 native 命令重現重複的 Invoke-Formatter 範例。檢查 PSUseConsistentWhitespace 在 verbatim-argument extent 附近對 CheckPipe 的處理;當重複格式化能保持空格穩定,而不是在 | 前再插入一個空格時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Steps to reproduce
Run the formatter repeatedly on a native command that uses the stop-parsing token:
$formatted = $null
1..3 | ForEach-Object {
$formatted = Invoke-Formatter ($formatted ?? 'cmd --% raw | text & stuff')
$formatted
}
Expected behavior
Formatting already formatted output should be a no-op. Spacing adjacent to the verbatim argument should either be left untouched or normalized once to a stable result.
Actual behavior
One additional space is inserted before | on every run:
cmd --% raw | text & stuff
cmd --% raw | text & stuff
cmd --% raw | text & stuff
The output grows without bound in a format-on-save loop.
The verbatim-argument token owns the text up to the pipe. PSUseConsistentWhitespace with CheckPipe sees a zero-width gap before | and inserts a space inside the verbatim argument's extent on each formatting pass.
Environment data
Reproduced with:
- PSScriptAnalyzer 1.25.0 on PowerShell 7.5.2
- PSScriptAnalyzer 1.25.0 on PowerShell 7.6.3
- PSScriptAnalyzer built from
mainat PowerShell/PSScriptAnalyzer@4b0117ca7d2887711c9699f467ba7171f8859156 on PowerShell 7.6.4
- 主要語言
- C#
- 星號
- 2.2k
- 分支
- 416
- 平均合併
- 13 小時 1 分鐘
- 30 天內合併 PR
- 2
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PowerShell/PSScriptAnalyzer 的其他 Issue
-
Up-for-Grabs
難度 1/5 1-3 小時 新手友好度 78/100
PowerShell/PSScriptAnalyzer#2213 · 2 則留言 ·
-
難度 4/5 3-5 天 新手友好度 32/100
PowerShell/PSScriptAnalyzer#2222 ·
-
難度 3/5 1-2 天 新手友好度 48/100
PowerShell/PSScriptAnalyzer#2220 ·
-
難度 3/5 1-2 天 新手友好度 55/100
PowerShell/PSScriptAnalyzer#2219 ·
-
難度 3/5 1-2 天 新手友好度 72/100
PowerShell/PSScriptAnalyzer#2218 ·
查看 PowerShell/PSScriptAnalyzer 的全部 Issue
相似的 Issue
-
agentic-workflows Needs: Triage :mag:
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 80/100
維護者通常 1 天內回覆
-
:watch: Not Triaged aspnet-core/svc fundamentals/subsvc Source - Docs.ms
難度 1/5 1 小時以內 新手友好度 85/100
dotnet/AspNetCore.Docs#37785 ·
維護者通常 1 天內回覆
-
needs-triage
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
維護者通常 1 天內回覆