PowerShell / PowerShell/PSScriptAnalyzer

Should Write-Host still be avoided?

オープン
#1,118 コメント 16 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Area - Documentation
主要言語
C#
スター
2.2k
フォーク
414
平均マージ
13時間 1分
マージ済み PR(30日)
2

説明

It's always been recommended to avoid using Write-Host because it outputs only to the console and not to any of the standard output streams. As of PowerShell 5.0, Write-Host is just a wrapper for Write-Information and thus outputs to the standard output streams similar to the other Write-* cmdlets.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/write-host?view=powershell-6

Should the use of Write-Host still be flagged as something to be avoided? Is it possible to implement a rule that only flags the use of Write-Host if the computer is running a version of PowerShell earlier than 5.0?

Thanks!

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Write-Host を警告する既存の analyzer rule と、バージョン 5.0 以降における Write-Host の動作について説明した関連する PowerShell ドキュメントを確認します。analyzer が PowerShell のバージョン間の違いをどのように処理しているかを判断します。この issue で要求されているバージョン対応の動作が実装され、適切な rule tests でカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
powershell
領域
devtools
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。