-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatter inserts redundant whitespace in ValidateSet attribute #1468
Comments
Also happening in this case: BeforeAll {
function Get-TypeNameAstFromScript
{
param([string]$Script)
$ast = [System.Management.Automation.Language.Parser]::ParseInput($Script, [ref]$null, [ref]$null)
$typeExpAst = $ast.Find({
$args[0] -is [System.Management.Automation.Language.TypeExpressionAst]
}, $true)
return $typeExpAst.TypeName
}
} It got formatted to BeforeAll {
function Get-TypeNameAstFromScript
{
param([string]$Script)
$ast = [System.Management.Automation.Language.Parser]::ParseInput($Script, [ref]$null, [ref]$null)
$typeExpAst = $ast.Find( {
$args[0] -is [System.Management.Automation.Language.TypeExpressionAst]
}, $true)
return $typeExpAst.TypeName
}
} |
YES. This drives me crazy. |
Hmm, thinking about it again, right now, I think the right expected behaviour should maybe rather be to also insert a space after the closing brace: function Get-Noun
{
param(
[ValidateScript( { Test-Path $_ } )]
$Path
)
} The reason why I think that is because PSSA has two configurable rules (that can be turned on or off individually):
The suggestion would be to add a third configurable option What do you think @Jaykul ? This way, the default settings would be symmetric but due to the configuration option, you could turn |
I want a space between a closing parenthesis or brace and an opening one, like: But I don't want them between "open" and "open" or between "close" and "close" That's especially true when there are more levels of them 🤔 |
Ok. Do I correctly understand that you want It's interesting because the logic to insert a space after an opening brace has been there since day 1 but I guess now that I've added the space inside braces, this asymmetry becomes more apparent... |
Steps to reproduce
Format the following snippet with the default settings:
Expected behavior
No changes to the line of
ValidateScript
Actual behavior
It inserts a space after the
(
ofValidateScript
:If an unexpected error was thrown then please report the full error details using e.g.
$error[0] | Select-Object *
Environment data
This happens in both PSSA 1.18.3 and 1.19.0
The text was updated successfully, but these errors were encountered: