description | ms.custom | ms.date | ms.topic | title |
---|---|---|---|---|
Place open braces consistently |
PSSA v1.22.1 |
06/28/2023 |
reference |
PlaceOpenBrace |
Severity Level: Warning
Open brace placement should follow a consistent style. It can either follow K&R style (on same line) or the Allman style (not on same line).
Note: This rule is not enabled by default. The user needs to enable it through settings.
Rules = @{
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $true
NewLineAfter = $true
IgnoreOneLineBlock = $true
}
}
Enable or disable the rule during ScriptAnalyzer invocation.
Enforce open brace to be on the same line as that of its preceding keyword.
Enforce a new line character after an open brace. The default value is true.
Indicates if open braces 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.