Skip to content
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

UseConsistentWhitespace.CheckOperator: Add unary operators that start with a dash (-split, -join, -not, -bnot, isplit, csplit) #1602

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

bergmeister
Copy link
Collaborator

@bergmeister bergmeister commented Oct 24, 2020

PR Summary

Related: #1239

In order to enable formatting corrections of this kind: $a-join$b --> $a -join $b or reducing too much whitespace but also -split$a --> -split $a with the added code as existing code for operators assumes that something precedes it.
The reason for adding the check that the unary operator starts with a dash is is to exclude things like $a++ or !$a where we do not want a whitespace character separation by default

PR Checklist

@daviesj
Copy link
Contributor

daviesj commented Oct 27, 2020

I tried this code out and noticed a couple things.
Checking that the operator starts with a dash introduces the following undesirable behavior: --$counter is changed to -- $counter. Also $counter-- is changed to $counter --
Unary operator -not does not get spacing if it follows a parenthesis such as if (-not$SomeVariable).

@rjmholt rjmholt marked this pull request as draft April 21, 2021 20:57
@rjmholt
Copy link
Contributor

rjmholt commented Apr 21, 2021

Converting to draft to resolve the various PRs

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

Successfully merging this pull request may close these issues.

None yet

4 participants