Skip to content

Enhance PSUseConsistentWhiteSpace to exclude more special cases when using unary operators #950

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

Open
bergmeister opened this issue Mar 28, 2018 · 2 comments

Comments

@bergmeister
Copy link
Collaborator

Found when discussing PR #949 , which already tweaked PSUseConsistentWhiteSpace when using unary operators inside parenthesis.
This adds another special case where the rule should be excluded. The community is welcome to provide more cases that need to be treated specially.

Steps to reproduce

Invoke-Formatter -ScriptDefinition '$r = $a -lt -$var'                                                                                                       

Expected behavior

$r = $a -lt -$var

Actual behavior

$r = $a -lt - $var

Environment data

This applies also to the latest version of the development branch.

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.251
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.251
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.16.1
@kalgiz
Copy link
Contributor

kalgiz commented Apr 12, 2018

@bergmeister Is the issue fixed in #949 ? If you are working at the issue or solved it, could you, please, assign it to you / close it etc. ? It would be easier to find issues that are not solved yet and nobody works at them.

@bergmeister
Copy link
Collaborator Author

@kalgiz No, this issue was created as part of #949 as James was thinking about other special cases that need to be tweaked as well. The PR fixed unary operators, but we thought that e.g. comparison operators would need a similar treatment as well.
Feel free to take any issue that is not assigned to me or where a PR is open against it. Yes, let's start using the rule of assigning issues to ourselves from the point that we start working on it. I left a few comments on some issues and keep some of them in the back of my mind but currently I am not actively working on them. Usually I only work for some time like an hour to do some analysis/repro on an issue and might decide to only leave a comment there so that anyone can start picking it up/continue in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants