Skip to content

PSUseConsistentWhitespace complains when consecutive assignment operations are aligned #1460

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

Closed
peetrike opened this issue Apr 24, 2020 · 1 comment

Comments

@peetrike
Copy link

Before submitting a bug report:

  • Make sure you are able to repro it on the latest released version
  • Perform a quick search for existing issues to check if this bug has already been reported

Steps to reproduce

Invoke-ScriptAnalyzer -ScriptDefinition @'
$e      = 3
$longer = $e
$h = @{
    a    = $longer
    long = 2
}
$h
'@ -Settings @{
    Rules = @{
        PSUseConsistentWhitespace  = @{
            Enable = $true
        }
    }
}

Expected behavior

When assignment operators are aligned, the PSUseConsistentWhitespace rule should not complain that there are more than one space before equal sign.

Actual behavior

RuleName                  Severity ScriptName Line Message
--------                  -------- ---------- ---- -------
PSUseConsistentWhitespace Warning             1    Use space before and after binary and assignment operators.
PSUseConsistentWhitespace Warning             4    Use space before and after binary and assignment operators.

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
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.18.3
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.18.3
@ghost ghost added the Needs: Triage 🔍 label Apr 24, 2020
@peetrike
Copy link
Author

it seems that I duplicated the #769

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