PowerShell / PowerShell/PSScriptAnalyzer

PSUseConsistentWhitespace CheckInnerBrace - false positive on hashtable closing brace

未关闭
#1,742 1 条评论 2 个 reaction 已指派 1 人 在 GitHub 查看

@bergmeister 已经在做这个了。

开始于 2021年11月13日。

Area - Formatter Issue - Bug
主要语言
C#
星标
2.2k
派生
414
平均合并
13 小时 1 分钟
30 天内合并 PR
2

描述

Steps to reproduce

Create a settings file with

@{
    Rules = @{
        PSUseConsistentWhitespace = @{
            Enable = $true
            CheckOpenBrace = $true
            CheckInnerBrace = $true
        }
    }
}

Create a script with

@{foo = 'bar'}

Expected behavior

No violation or at least a violation for both the missing space at the start and end.

Actual behavior

RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSUseConsistentWhitespace           Warning      jordan.ps1 1     Use space before closing brace.

Adding -Fix will change the file to the following (space added before end brace)

@{foo = 'bar' }

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Linux 5.14.16-201.fc34.x86_64 #1 SMP Wed Nov 3 13:57:29 UTC 2021
Platform                       Unix
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.20.0

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。