PowerShell / PowerShell/PSScriptAnalyzer
Invoke-Formatter: Adding whitespace after opening parenthesis
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
Not sure if a parameter to control this behavior. I looked but couldn't find any, correct me if I'm wrong.
Steps to reproduce
Invoke-Formatter -ScriptDefinition '$object.Where({ $_.Property -eq $Value })' -Verbose
Expected behavior
Default I would expect it not to add any space after parenthesis.
$object.Where({ $_.Property -eq $Value })
Or if default should be to add a space after the open parenthesis, I would expect it to also add one before the closing parenthesis by default too. 🙂
$object.Where( { $_.Property -eq $Value } )
Actual behavior
Adds one space after the opening parenthesis.
$object.Where( { $_.Property -eq $Value })
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.18890.1000
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18890.1000
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.18.1
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
Start by reproducing the Invoke-Formatter example with the supplied ScriptDefinition and compare the actual output with both expected forms. Trace the formatter entry point to find where spacing around parentheses is decided, then add or update coverage so the chosen default behavior is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100