PowerShell / PowerShell/PSScriptAnalyzer

UseCompatibleCommands should recognise partial parameter matches

Open
#1,201 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary of the new feature

PowerShell allows for the usage of partial parameter names, like Import-Module 'MyModule' -Pass.

UseCompatibleCommands currently sees this is a compatibility error.

While PSScriptAnalyzer should discourage truncated parameter names (like command aliases), UseCompatibleCommands should be able to recognise the difference between a truncated parameter that will work and something that will not.

Proposed technical implementation details (optional)

The query API currently uses a dictionary to look up parameters. Instead of this, it should lazily compute a trie of parameters that is able to tell whether a parameter is uniquely resolved given an input.

What is the latest version of PSScriptAnalyzer at the point of writing

1.18.0

/cc @JamesWTruher

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

Start by tracing UseCompatibleCommands and its query API to find the current dictionary-based parameter lookup. Check how partial PowerShell parameter names are classified, then verify behavior for uniquely resolved and ambiguous or invalid truncations. Done means valid partial matches are accepted without weakening the analyzer's existing compatibility checks.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.