Closed
Description
Steps to reproduce
Here is setting snapshot I'm trying to use:
@{
IncludeRules = @(
'PSUseConsistentWhitespace')
Rules = @{
PSUseConsistentWhitespace = @{
# Checks if there is a space between a keyword and its corresponding open brace.
# E.g. foo { } instead of foo{ }
# default = true (powershell.codeFormatting.whitespaceBeforeOpenBrace)
CheckOpenBrace = $true
}
}
And here is sample test function, not that open brace is not new line!
function Test-Foo()
{
}
Expected behavior
No warning is shown for bellow function
# NO WARNING HERE
function Test-Foo()
{
}
Actual behavior
Warning is shown because brace is on next line, there is no need for any space here,
This warning is valid only if open brace is on same line as function name.
# PSUseConsistentWhitespace Warning Use space before open brace.
function Test-Foo()
{
}
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 7.0.2
PSEdition Core
GitCommitId 7.0.2
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.19.0