PowerShell / PowerShell/PSScriptAnalyzer

New Rule Suggestion: PSAvoidShorteningParameterNames

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

還沒有人認領這個 Issue。

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

描述

As long as we're trying to get people to stop using aliases and positional parameters and shortened command names, we should fix the parameters too.

Summary of the new feature

A new rule that complains when you write Get-Content -Pa file.txt -ov contents and offers suggestions with the full proper parameter name of each parameter: Get-Content -Path file.txt -OutVariable contents

It should complain about shortened parameters and parameter aliases, when you're passing them directly -- but shouldn't worry about splatting or pipeline properties, etc.

Bonus points if you make it a ConfigurableRule with a setting to ignore parameter names that match aliases (as opposed to just being shortened forms of parameters or parameter aliases).

Double bonus points if you make AvoidPositionalParameters also a ConfigurableRule so people can choose to fail even if only one positional parameter is passed.

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

未指定檔案或測試。先找出 PSScriptAnalyzer 中現有的 AvoidPositionalParameters 規則和 ConfigurableRule 模式,接著追蹤規則如何檢查命令參數。完成的標準是新規則能處理縮短名稱和別名,同時排除 splatting 和 pipeline 屬性;如果實作了選用設定和對 AvoidPositionalParameters 的變更,則分別支援它們。

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

評估

技術堆疊
csharp, powershell
領域
cli, tooling
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
25/100

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

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