Rule request: AvoidDefaultEncoding
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- powershell
- 領域
- devtools
調査の方向性
まず PSUseCompatibleCommands ルールとその互換性プロファイルを確認し、次にリンクされている Windows PowerShell と PowerShell のエンコーディングに関するドキュメントを比較します。互換性分析が有効な場合の -Encoding Default と -Encoding utf8 に対する想定される診断を定義し、新しい値である Ansi と utf8NoBom をどのように扱うべきかも含めます。ルールの動作と対応するカバレッジがその決定を反映した時点で、issue は完了です。
索引モデルが issue の本文から書いたものです。
説明
Apparently the default encoding -Encoding Default is removed from the cmdlet documentation that supports the -Encoding parameter. See e.g.:
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-content?view=powershell-5.1
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-content?view=powershell-7.5
Which makes sense in a way that this might cause compatibility issues when something is e.g. written (using -Encoding Default in Windows PowerShell 5.1 and read back in PowerShell 7 (e.g. after a PowerShell update migration). Yet, afaik, this isn't captured by any of the UseCompatibleCommands profiles either (probably because the default value is still accepted.
Also note:
- that using any of the newer encoding values as
Ansiandutf8NoBomin PowerShell 7 might cause an incompatibility issue with older versions of PowerShell. - the implementation of the
-Encoding utf8value also differs between Windows PowerShell and newer versions of PowerShell:- Character encoding in Windows PowerShell:
UTF8Uses UTF-8 (with BOM). - Character encoding in PowerShell:
utf8: Encodes in UTF-8 format (no BOM).
- Character encoding in Windows PowerShell:
Therefore I think that it is wise to avoid the default and utf8 encoding (-Encoding Default and -Encoding utf8) when PSUseCompatibleCommands is enabled in the PSScriptAnalyzer settings.
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 415
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PowerShell/PSScriptAnalyzer のほかの issue
-
Up-for-Grabs
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
PowerShell/PSScriptAnalyzer#2213 · コメント 2 件 ·
-
難易度 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 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
PowerShell/PSScriptAnalyzer#2211 ·
-
`PSPlaceOpenBrace` and `PSPlaceCloseBrace` leave trailing whitespace when expanding one-line blocks オープン
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
PowerShell/PSScriptAnalyzer#2210 ·