PowerShell / PowerShell/PSScriptAnalyzer

Rule request: AvoidDefaultEncoding

未關閉
#2,079 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

Up for Grabs
主要語言
C#
星號
2.2k
分支
415
平均合併
13 小時 1 分鐘
30 天內合併 PR
2

描述

Apparently the default encoding -Encoding Default is removed from the cmdlet documentation that supports the -Encoding parameter. See e.g.:

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 Ansi and utf8NoBom in PowerShell 7 might cause an incompatibility issue with older versions of PowerShell.
  • the implementation of the -Encoding utf8 value also differs between Windows PowerShell and newer versions of 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.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先檢視 PSUseCompatibleCommands 規則及其相容性設定檔,然後比較連結的 Windows PowerShell 和 PowerShell 編碼文件。在啟用相容性分析時,定義 -Encoding Default 和 -Encoding utf8 的預期診斷,包括應如何處理較新的值 Ansi 和 utf8NoBom;當規則行為和相應的涵蓋率反映該決定時,此 issue 即完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
powershell
領域
devtools
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。