Warn on using incomplete parameter name

Open
#294 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
powershell
Domain
tooling

Research direction

Start by locating the analyzer entry point that handles PowerShell command parameters. Reproduce the Get-Foo -R scenario with two parameters sharing that prefix, then determine the expected warning behavior and add coverage for incomplete and ambiguous parameter names.

Written by the indexing model from the issue text.

Description

Issue - New Rule Up-for-Grabs

You open your script up to a future breaking change if you use a command parameter and not specifying the full parameter name. For instance, say I use Get-Foo -R in Foo module v1 where Get-Foo has only one switch parameter -Recurse. This works until Foo v2 comes out and the author has add a new parameter to Get-Foo called -Rollback. Now all of a sudden that script with Get-Foo -R will start failing due to an ambiguous parameter name.

Dominant language
C#
Stars
2.2k
Forks
415
Avg merge
13h 1m
Merged PRs (30d)
2

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.

More from PowerShell/PSScriptAnalyzer

All issues in PowerShell/PSScriptAnalyzer

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.