description | ms.date | ms.topic | title |
---|---|---|---|
Place close braces |
06/28/2023 |
reference |
PlaceCloseBrace |
Severity Level: Warning
Close brace placement should follow a consistent style. It should be on a new line by itself and should not be followed by an empty line.
Note: This rule is not enabled by default. The user needs to enable it through settings.
Rules = @{
PSPlaceCloseBrace = @{
Enable = $true
NoEmptyLineBefore = $false
IgnoreOneLineBlock = $true
NewLineAfter = $true
}
}
Enable or disable the rule during ScriptAnalyzer invocation.
Create violation if there is an empty line before a close brace.
Indicates if closed brace pairs in a one line block should be ignored or not. For example,
$x = if ($true) { 'blah' } else { 'blah blah' }
, if the property is set to true then the rule
doesn't fire a violation.
Indicates if a new line should follow a close brace. If set to true a close brace should be followed by a new line.