-
Notifications
You must be signed in to change notification settings - Fork 383
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
Invoke-Formatter do nothing :( #2012
Comments
Hey @hitriyvalenok 👋, There isn't a rule in PSSA which causes So for instance, the below: $var = @{
} Would be formatted (in the default config) to: $var = @{
} Hopefully that makes sense! |
Thanks! I got it now. I must make all multiline expressions (string concatenation or member chained call) inline. Examples: $string = 'hello' +`
'world'
===>
$string = 'hello' + 'world'
InokeSomething 'arg1'`
'arg2'
===>
InokeSomething 'arg1' 'arg2'
$var = $true |`
$false
===>
$var = $true | $false Can I do it with the formatter? My attempts fail :( Thanks! |
There aren't currently any rules that enforce the layout of expressions to a single line. The current crop of layout rules really focus on:
Amongst others. You could put together a pull request to introduce a new rule/edit an existing rule to accommodate your requirements - but I don't know that they'd be particularly popular or that the PR would be accepted. There's value to having whitespace and spacing things out in general for readability. Certainly a rule that enforced single-line expressions would be unpopular. You could look into creating a custom rule for yourself in PowerShell.
Hope that helps! |
I need to inline variable assignments only. Nothing more. For example, I have:
Exptected:
Full example:
But the cmdlet does nothing for me. It returns the code I passed without a tiny change as I've just asked to return $code back untouched. What I'm doing wrong?
The text was updated successfully, but these errors were encountered: