PowerShell / PowerShell/PSScriptAnalyzer
Rule to enforce new line after a statement
未關閉
還沒有人認領這個 Issue。
Area - Rules
Issue - New Rule
- 主要語言
- C#
- 星號
- 2.2k
- 分支
- 414
- 平均合併
- 13 小時 1 分鐘
- 30 天內合併 PR
- 2
描述
If Invoke-Formatter is given a single line script, then it fails to format the script properly.
PS> $settings = Import-PowerShellDataFile .\path\to\module\Settings\CodeFormatting.psd1
PS> $settings.Rules.PSPlaceOpenBrace.IgnoreOneLineBlock = $false
PS> $settings.Rules.PSPlaceCloseBrace.IgnoreOneLineBlock = $false
PS> Invoke-Formatter -ScriptDefinition 'function foo{param($a)foreach($foo in (1..10)){$_}}' -Settings $settings
function foo {
param($a)foreach ($foo in (1..10)) {
$_
}
}
the foreach statement should be on its own line.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用單行函式和 .\path\to\module\Settings\CodeFormatting.psd1 中的設定,透過 Invoke-Formatter 重現此問題。追蹤格式化程式如何處理嵌入的 foreach 陳述式。完成的標準是 foreach 陳述式被放置在獨立的一行,同時仍遵循所顯示的大括號設定。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- powershell
- 領域
- tooling
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100