PowerShell / PowerShell/PSScriptAnalyzer

Warn when partial enumeration values are used

オープン
#600 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

説明

Here's a little known feature that could come back to bite someone later with a broken script:

gsv blah -ea ig

I'm not sure in which version of PowerShell this was added, but you can now use partial enumeration values and as long as that partial value leads to an unambiguous match, it will be accepted.

This may result in errors in scripts that appear to be working correctly if a new emumeration value is added with the same leading characters as those that are in use within a script. It's the same issue/risk with using partial parameter names in scripts. Shorthand should be for ad-hoc use only, and PSScriptAnalyzer should have a rule that warns whenever an enumeration value is used in a script in shorthand (such as in the command above).

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

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

はじめの一歩

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

調査の方向性

調査対象の挙動として gsv blah -ea ig の例を使用し、比較可能な警告に対応する既存の PSScriptAnalyzer ルールとテスト構成を見つけてください。曖昧でない部分的な列挙値を使用するスクリプトが警告を生成し、完全な値は引き続き受け入れられれば完了です。

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

評価

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

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

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