PowerShell / PowerShell/PSScriptAnalyzer
Rule request: AvoidDefaultEncoding
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず PSUseCompatibleCommands ルールとその互換性プロファイルを確認し、次にリンクされている Windows PowerShell と PowerShell のエンコーディングに関するドキュメントを比較します。互換性分析が有効な場合の -Encoding Default と -Encoding utf8 に対する想定される診断を定義し、新しい値である Ansi と utf8NoBom をどのように扱うべきかも含めます。ルールの動作と対応するカバレッジがその決定を反映した時点で、issue は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- powershell
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100