PowerShell / PowerShell/PSScriptAnalyzer
Code Formatting : Whitespacing one line hashtable
オープン
まだ誰も着手していません。
Area - Rules
Issue - Bug
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
Hello
I am looking for a improvment on the current formatting tools by adding a whitespace after open bracket and before closing non empty curly brackets like :
#Actual
$emptyHash = @{ } # an empty Hash
$myHash = @{foo = "bar"}
#Expected
$emptyHash = @{} # an empty Hash
$myHash = @{ foo = "bar" } #whitespace after `{ `and before ` }`
Additional information:
-
I use the PowerShell extension on VS Code to format automaticaly my code on save.
-
My settings.json file:
{
"editor.formatOnSave": true,
"powershell.codeFormatting.preset": "Custom",
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.codeFormatting.ignoreOneLineBlock": false,
"powershell.codeFormatting.newLineAfterCloseBrace": true,
"powershell.codeFormatting.newLineAfterOpenBrace": true,
"powershell.codeFormatting.openBraceOnSameLine": false,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
"powershell.scriptAnalysis.enable": true,
"files.trimTrailingWhitespace": true,
}
This feature exist on other language :
https://github.com/Microsoft/TypeScript/issues/9613#issuecomment-268460847
Regards,
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue ではファイルもテストも指定されていません。まず、1 行の hashtables に対する PowerShell のコードフォーマット処理を特定し、記載されているカスタム設定を使って issue の例を再現します。空でない中括弧付きの hashtables に周囲の空白が追加され、空の hashtables は変更されないことを、両方のケースをカバーして確認できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, powershell
- 領域
- developer-experience, tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100