Skip to content

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

Description

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

Activity

  1. kalgiz commented on Apr 12, 2018

    @kalgiz
    Contributor

    Christoph Bergmeister (@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.

  2. bergmeister commented on Apr 12, 2018

    @bergmeister
    CollaboratorAuthor

    Klaudia Algiz (@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions