PowerShell / PowerShell/PSScriptAnalyzer
Rule Request: Warn Against Special Characters that PowerShell Accepts
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
Powershell 7 supports the use of Em Dash ( – ) for parameter prefixes, while Windows Powershell doesn't and can cause errors such as
Invoke-Command –ComputerName $Computer ...
–ComputerName $Computer
The string is missing the terminator: "
I'm not sure how but in the last month a good dozen Em Dashes were accidentally added to my codebase.
As Em Dashes are almost impossible to notice in a fix width font, I think it should be considered best practice to never use them and put a big error/warning on screen when you come across one.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation file, test, or entry point is named. Start by locating the existing rule registration and rule tests in PSScriptAnalyzer, then determine how an em dash in a PowerShell parameter position should be reported. Done means the analyzer consistently warns about the character and tests cover the reported case.
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