PowerShell / PowerShell/PSScriptAnalyzer

New Rule Suggestion: PSAvoidShorteningParameterNames

Open
#1,173 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Rules Up-for-Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the existing AvoidPositionalParameters rule and the ConfigurableRule pattern in PSScriptAnalyzer, then trace how rules inspect command parameters. Done means the new rule handles shortened names and aliases while excluding splatting and pipeline properties; the optional configuration and AvoidPositionalParameters changes are separately supported if implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.