PSUseConsistentWhitespace - Ability to ignore if in a line with multiple pipes
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
研究方向
檢視目前的 PSUseConsistentWhitespace 規則以及連結的未解決 issue,以了解空白在各個 pipeline 中如何套用。定義包含多個 pipe 的行的確切行為,然後確認提議的忽略行為會保留現有的格式檢查,不會影響其他情況。
由索引模型根據 Issue 內容生成。
描述
Summary of the new feature
The various PSUseConsistentWhitespace rules have various issues that might never be solved:
My biggest issue is that I don't want it to touch one liners or multiliners like this:
(
(
Invoke-RestMethod -Method 'Get' -Uri 'https://api.github.com/repos/chocolatey/choco/releases'
) | Where-Object -Property 'prerelease' -NE $true
).'tag_name' | Sort-Object -Property @{'Expression' = {[System.Version]$_}} -Descending | Select-Object -First 1
Which becomes this:
(
(
Invoke-RestMethod -Method 'Get' -Uri 'https://api.github.com/repos/chocolatey/choco/releases'
) | Where-Object -Property 'prerelease' -NE $true
).'tag_name' | Sort-Object -Property @{'Expression' = { [System.Version]$_ } } -Descending | Select-Object -First 1
If I could tell PSScriptAnalyzer to ignore cases like that I'd be happy.
Current impact
This makes it so that I don't use the code formatting presets, and instead define all the rules manually and disable most of the PSUseConsistentWhitespace rules.
Side note: Would be great with the ability to override built-in presets, so you don't have to specify all the rules.
- 2017-03-07 "Add ability to inherit settings": https://github.com/PowerShell/PSScriptAnalyzer/issues/791
- 2024-12-01 "Code formatting preset - Add ability to override settings set by preset": https://github.com/PowerShell/vscode-powershell/issues/5109
Proposed technical implementation details (optional)
Don't know. Some ideas:
- Ability to ignore if more than one pipe `| is found on the same line?
What is the latest version of PSScriptAnalyzer at the point of writing
v1.24.0
- 主要語言
- C#
- 星號
- 2.2k
- 分支
- 415
- 平均合併
- 13 小時 1 分鐘
- 30 天內合併 PR
- 2
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PowerShell/PSScriptAnalyzer 的其他 Issue
-
Up-for-Grabs
難度 1/5 1-3 小時 新手友好度 78/100
PowerShell/PSScriptAnalyzer#2213 · 2 則留言 ·
-
難度 3/5 1-2 天 新手友好度 55/100
PowerShell/PSScriptAnalyzer#2219 ·
-
難度 3/5 1-2 天 新手友好度 72/100
PowerShell/PSScriptAnalyzer#2218 ·
-
難度 3/5 1-2 天 新手友好度 72/100
PowerShell/PSScriptAnalyzer#2217 · 1 則留言 ·
-
PSUseConsistentIndentation double-indents attribute bodies that open a scriptblock (`[Attr({ … })]`)未關閉
難度 3/5 1-2 天 新手友好度 70/100
PowerShell/PSScriptAnalyzer#2216 · 2 則留言 · 1 個 reaction ·
查看 PowerShell/PSScriptAnalyzer 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
builtbybel/CrapFixer#112 ·
-
area-ai untriaged
難度 2/5 1-3 小時 新手友好度 85/100
dotnet/extensions#7790 ·
維護者通常 1 天內回覆
-
Beginner Friendly T: Bugfix
難度 2/5 1-3 小時 新手友好度 82/100
space-wizards/space-station-14#46220 ·
維護者通常 1 天內回覆
-
P2 testing
難度 1/5 1 小時以內 新手友好度 90/100
維護者通常 1 天內回覆
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
難度 2/5 1-3 小時 新手友好度 78/100
dotnet/runtime#134766 · 3 則留言 ·
維護者通常 1 天內回覆